Class: Pechkin::Command::Dispatcher
- Inherits:
-
Object
- Object
- Pechkin::Command::Dispatcher
- Defined in:
- lib/pechkin/command.rb
Overview
Dispatch command. Commands are placed in fixed order to allow matching rules be executed in right way. For example at first we check for –add-auth and than for –check. At the moment only RunServer should be last element of this sequence.
Constant Summary collapse
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#dispatch ⇒ Object
Dispatch command according to provided options.
-
#initialize(cli_options) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
Constructor Details
#initialize(cli_options) ⇒ Dispatcher
Returns a new instance of Dispatcher.
28 29 30 |
# File 'lib/pechkin/command.rb', line 28 def initialize() @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
25 26 27 |
# File 'lib/pechkin/command.rb', line 25 def @options end |
Instance Method Details
#dispatch ⇒ Object
Dispatch command according to provided options
33 34 35 |
# File 'lib/pechkin/command.rb', line 33 def dispatch COMMANDS.map { |c| c.new() }.find(&:matches?) end |