Module: Foobara::CommandPatternImplementation::Concerns::Callbacks::ClassMethods
- Defined in:
- foobara-0.0.141/projects/command/src/command_pattern_implementation/concerns/callbacks.rb
Instance Method Summary collapse
- #after_subclass_defined ⇒ Object
- #inherited(subclass) ⇒ Object
- #remove_all_callbacks ⇒ Object
- #state_machine_callback_registry ⇒ Object
Instance Method Details
#after_subclass_defined ⇒ Object
18 19 20 |
# File 'foobara-0.0.141/projects/command/src/command_pattern_implementation/concerns/callbacks.rb', line 18 def after_subclass_defined(&) subclass_defined_callbacks.register_callback(:after, &) end |
#inherited(subclass) ⇒ Object
12 13 14 15 16 |
# File 'foobara-0.0.141/projects/command/src/command_pattern_implementation/concerns/callbacks.rb', line 12 def inherited(subclass) super subclass_defined_callbacks.runner.callback_data(subclass).run end |
#remove_all_callbacks ⇒ Object
38 39 40 41 42 43 |
# File 'foobara-0.0.141/projects/command/src/command_pattern_implementation/concerns/callbacks.rb', line 38 def remove_all_callbacks Foobara::Command::StateMachine.remove_all_callbacks if defined?(@state_machine_callback_registry) remove_instance_variable(:@state_machine_callback_registry) end end |
#state_machine_callback_registry ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'foobara-0.0.141/projects/command/src/command_pattern_implementation/concerns/callbacks.rb', line 22 def state_machine_callback_registry return @state_machine_callback_registry if defined?(@state_machine_callback_registry) @state_machine_callback_registry = if superclass.respond_to?(:state_machine_callback_registry) Callback::Registry::ChainedConditioned.new( superclass.state_machine_callback_registry ) else Callback::Registry::Conditioned.new( from: Foobara::Command::StateMachine.states, transition: Foobara::Command::StateMachine.transitions, to: Foobara::Command::StateMachine.states ) end end |