mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Use condition_type in case statement for included?.
This commit is contained in:
parent
40ed7b57bd
commit
7fbf7e536d
@ -25,7 +25,7 @@ module ActiveModel
|
|||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def included?(serializer)
|
def included?(serializer)
|
||||||
case condition
|
case condition_type
|
||||||
when :if
|
when :if
|
||||||
serializer.public_send(condition)
|
serializer.public_send(condition)
|
||||||
when :unless
|
when :unless
|
||||||
@ -38,13 +38,14 @@ module ActiveModel
|
|||||||
private
|
private
|
||||||
|
|
||||||
def condition_type
|
def condition_type
|
||||||
if options.key?(:if)
|
@condition_type ||=
|
||||||
:if
|
if options.key?(:if)
|
||||||
elsif options.key?(:unless)
|
:if
|
||||||
:unless
|
elsif options.key?(:unless)
|
||||||
else
|
:unless
|
||||||
:none
|
else
|
||||||
end
|
:none
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def condition
|
def condition
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user