Use condition_type in case statement for included?.

This commit is contained in:
Chris Nixon 2016-01-09 16:32:17 -08:00 committed by Lucas Hosseini
parent 40ed7b57bd
commit 7fbf7e536d

View File

@ -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