Source: show | on GitHub
# File lib/aasm/state.rb, line 4 def initialize(name, options={}) @name = name update(options) end
# File lib/aasm/state.rb, line 9 def ==(state) if state.is_a? Symbol name == state else name == state.name end end
# File lib/aasm/state.rb, line 17 def call_action(action, record) action = @options[action] catch :halt_aasm_chain do action.is_a?(Array) ? action.each {|a| _call_action(a, record)} : _call_action(action, record) end end
# File lib/aasm/state.rb, line 26 def display_name @display_name ||= name.to_s.gsub(/_/, ' ').capitalize end
# File lib/aasm/state.rb, line 30 def for_select [display_name, name.to_s] end
# File lib/aasm/state.rb, line 34 def update(options = {}) if options.key?(:display) then @display_name = options.delete(:display) end @options = options self end