mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16: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
|
||||
#
|
||||
def included?(serializer)
|
||||
case condition
|
||||
case condition_type
|
||||
when :if
|
||||
serializer.public_send(condition)
|
||||
when :unless
|
||||
@ -38,13 +38,14 @@ module ActiveModel
|
||||
private
|
||||
|
||||
def condition_type
|
||||
if options.key?(:if)
|
||||
:if
|
||||
elsif options.key?(:unless)
|
||||
:unless
|
||||
else
|
||||
:none
|
||||
end
|
||||
@condition_type ||=
|
||||
if options.key?(:if)
|
||||
:if
|
||||
elsif options.key?(:unless)
|
||||
:unless
|
||||
else
|
||||
:none
|
||||
end
|
||||
end
|
||||
|
||||
def condition
|
||||
|
||||
Loading…
Reference in New Issue
Block a user