Class: Controll::Flow::ActionMapper::Complex
- Defined in:
- lib/controll/flow/action_mapper/complex.rb
Class Attribute Summary collapse
-
.action_clazz ⇒ Object
writeonly
Sets the attribute action_clazz.
-
.event_maps ⇒ Object
readonly
Returns the value of attribute event_maps.
-
.types ⇒ Object
readonly
Returns the value of attribute types.
Instance Attribute Summary collapse
-
#event_maps ⇒ Object
readonly
Returns the value of attribute event_maps.
Class Method Summary collapse
- .action(controller, event) ⇒ Object
-
.event_map(*args, &block) ⇒ Object
writer also auto-adds type to types.
-
.event_map_for(type = :notice) ⇒ Object
reader.
-
.inherited(base) ⇒ Object
this method could be generated whenever a class inherits from ActionHandler class?.
Methods inherited from Base
Class Attribute Details
.action_clazz=(value) ⇒ Object (writeonly)
Sets the attribute action_clazz
6 7 8 |
# File 'lib/controll/flow/action_mapper/complex.rb', line 6 def action_clazz=(value) @action_clazz = value end |
.event_maps ⇒ Object (readonly)
Returns the value of attribute event_maps.
7 8 9 |
# File 'lib/controll/flow/action_mapper/complex.rb', line 7 def event_maps @event_maps end |
.types ⇒ Object (readonly)
Returns the value of attribute types.
7 8 9 |
# File 'lib/controll/flow/action_mapper/complex.rb', line 7 def types @types end |
Instance Attribute Details
#event_maps ⇒ Object (readonly)
Returns the value of attribute event_maps.
3 4 5 |
# File 'lib/controll/flow/action_mapper/complex.rb', line 3 def event_maps @event_maps end |
Class Method Details
.action(controller, event) ⇒ Object
16 17 18 19 20 |
# File 'lib/controll/flow/action_mapper/complex.rb', line 16 def action controller, event action_types ||= types path = path_finder(event).path path_action_class.new controller, path unless path.blank? end |
.event_map(*args, &block) ⇒ Object
writer also auto-adds type to types
30 31 32 33 34 35 36 37 38 |
# File 'lib/controll/flow/action_mapper/complex.rb', line 30 def event_map *args, &block @event_maps ||= {} @types ||= [] return @event_maps if args.empty? && !block_given? type = args.first.kind_of?(Symbol) ? args.shift : :notice event_maps[type.to_sym] = block_given? ? instance_eval(&block) : args.first @types << type unless types.include?(type) end |
.event_map_for(type = :notice) ⇒ Object
reader
23 24 25 26 |
# File 'lib/controll/flow/action_mapper/complex.rb', line 23 def event_map_for type = :notice @event_maps ||= {} event_maps[type.to_sym] || {} end |
.inherited(base) ⇒ Object
this method could be generated whenever a class inherits from ActionHandler class?
10 11 12 13 14 |
# File 'lib/controll/flow/action_mapper/complex.rb', line 10 def inherited base if base.parent.respond_to? :add_action_handler base.add_action_handler self.name.demodulize end end |