Class: Pressy::Command::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/pressy/command/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(registry, site, console, env) ⇒ Runner

Returns a new instance of Runner



2
3
4
5
6
7
# File 'lib/pressy/command/runner.rb', line 2

def initialize(registry, site, console, env)
  @registry = registry
  @site = site
  @console = console
  @env = env
end

Instance Method Details

#run(action, *args) ⇒ Object



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

def run(action, *args)
  raise "no action given" unless action

  command_type = @registry.lookup(action) or raise "unexpected action '#{action.to_s}'"
  options = command_type.parse!(args)
  command_type.new(@site, @console, @env).run(options, *args)
end