Module: Gyunyu::Command

Defined in:
lib/gyunyu/command.rb,
lib/gyunyu/command/export/app.rb,
lib/gyunyu/command/export/option.rb,
lib/gyunyu/command/export/format/csv.rb,
lib/gyunyu/command/export/format/json.rb,
lib/gyunyu/command/export/format/yaml.rb,
lib/gyunyu/command/export/custom_filter.rb,
lib/gyunyu/command/export/total_estimate.rb

Defined Under Namespace

Modules: Export Classes: NotFound

Class Method Summary collapse

Class Method Details

.app_const(command) ⇒ Object



17
18
19
# File 'lib/gyunyu/command.rb', line 17

def self.app_const( command )
  Gyunyu::Command.const_get(command.capitalize).const_get('App')
end

.commandsObject



5
6
7
# File 'lib/gyunyu/command.rb', line 5

def self.commands
  constants.map { |e| e.to_s.downcase }
end

.dispatch(command) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/gyunyu/command.rb', line 9

def self.dispatch( command )
  if commands.include?( command )
    app_const( command ).new.run
  else
    raise NotFound, command
  end
end