class Workflow::EventCollection
Public Instance Methods
[](name)
click to toggle source
Calls superclass method
# File lib/workflow/event_collection.rb, line 4 def [](name) super name.to_sym # Normalize to symbol end
first_applicable(name, object_context)
click to toggle source
# File lib/workflow/event_collection.rb, line 29 def first_applicable(name, object_context) (self[name] || []).detect do |event| event.condition_applicable?(object_context) && event end end
flat()
click to toggle source
# File lib/workflow/event_collection.rb, line 14 def flat self.values.flatten.uniq do |event| [:name, :transitions_to, :meta, :action].map { |m| event.send(m) } end end
include?(name_or_obj)
click to toggle source
# File lib/workflow/event_collection.rb, line 20 def include?(name_or_obj) case name_or_obj when Event flat.include? name_or_obj else !(self[name_or_obj].nil?) end end
push(name, event)
click to toggle source
# File lib/workflow/event_collection.rb, line 8 def push(name, event) key = name.to_sym self[key] ||= [] self[key] << event end