1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

Fix: _fire method is too long issue

This commit is contained in:
Rahul Ojha 2019-05-27 10:29:51 +05:30 committed by Anil Kumar Maurya
parent b0f035e8e1
commit ee212acd30

View file

@ -131,14 +131,14 @@ module AASM::Core
if to_state == ::AASM::NO_VALUE
to_state = nil
elsif to_state.respond_to?(:to_sym) && transitions.map(&:to).flatten.include?(to_state.to_sym)
# nop, to_state is a valid to-state
else
elsif !(to_state.respond_to?(:to_sym) && transitions.map(&:to).flatten.include?(to_state.to_sym))
# to_state is an argument
args.unshift(to_state)
to_state = nil
end
# nop, to_state is a valid to-state
transitions.each do |transition|
next if to_state and !Array(transition.to).include?(to_state)
if (options.key?(:may_fire) && transition.eql?(options[:may_fire])) ||