class Pechkin::Command::Dispatcher

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.

Constants

COMMANDS

Attributes

options[R]

Public Class Methods

new(cli_options) click to toggle source

@param cli_options [OpenStruct] command line options object

# File lib/pechkin/command.rb, line 28
def initialize(cli_options)
  @options = cli_options
end

Public Instance Methods

dispatch() click to toggle source

Dispatch command according to provided options

# File lib/pechkin/command.rb, line 33
def dispatch
  COMMANDS.map { |c| c.new(options) }.find(&:matches?)
end