Class: ComposedCommands::ComposedCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/composed_commands/composed_command.rb

Instance Attribute Summary

Attributes inherited from Command

#execution, #message, #result, #state

Class Method Summary collapse

Methods inherited from Command

#halted?, #initialize, perform, #perform

Constructor Details

This class inherits a constructor from ComposedCommands::Command

Class Method Details

.commandsObject



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, options = {})
  (@commands ||= []).push(klass.new(options))
end