Module: OrderStatus::ClassMethods

Defined in:
lib/order_status.rb

Instance Method Summary collapse

Instance Method Details

#workflow_event_namesObject



116
117
118
# File 'lib/order_status.rb', line 116

def workflow_event_names
  workflow_events.keys
end

#workflow_eventsObject

returns a Hash where keys are event name and values are event object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/order_status.rb', line 99

def workflow_events
  events = workflow_spec.states.values.collect &:events

  # skip blank values
  events = events.select { |e| e.present? }

  # flatten
  events_hash = Hash.new
  events.each do |v|
    v.each do |key,value|
      events_hash[key] = value
    end
  end

  events_hash
end