Class: ComposedCommands::ComposedCommand
- Defined in:
- lib/composed_commands/composed_command.rb
Instance Attribute Summary
Attributes inherited from Command
#execution, #message, #result, #state
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Command
#halted?, #initialize, perform, #perform
Constructor Details
This class inherits a constructor from ComposedCommands::Command
Class Method Details
.commands ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/composed_commands/composed_command.rb', line 6 def self.commands inherited_commands = if self.superclass.respond_to?(:commands) self.superclass.commands else [] end Array(inherited_commands) + Array(@commands) end |
.use(klass, options = {}) ⇒ Object
15 16 17 |
# File 'lib/composed_commands/composed_command.rb', line 15 def self.use(klass, = {}) (@commands ||= []).push(ComposedCommands::CommandFactory.new(klass, )) end |
Instance Method Details
#commands ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/composed_commands/composed_command.rb', line 19 def commands self.class.commands.map do |command_factory| command = command_factory.create before_execute(command) if respond_to? :before_execute command end end |