Class: Fleetctl::Command

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*cmd) {|runner| ... } ⇒ Command

Returns a new instance of Command.

Yields:



12
13
14
15
# File 'lib/fleetctl/command.rb', line 12

def initialize(*cmd)
  @command = cmd
  yield(runner) if block_given?
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



3
4
5
# File 'lib/fleetctl/command.rb', line 3

def command
  @command
end

Class Method Details

.run(*cmd, &blk) ⇒ Object



6
7
8
9
# File 'lib/fleetctl/command.rb', line 6

def run(*cmd, &blk)
  obj = new(*cmd, &blk)
  obj.run
end

Instance Method Details

#run(*args) ⇒ Object



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

def run(*args)
  runner.run(*args)
  runner
end

#runnerObject



22
23
24
25
# File 'lib/fleetctl/command.rb', line 22

def runner
  klass = "Fleetctl::Runner::#{Fleetctl.options.runner_class}".constantize
  @runner ||= klass.new(expression)
end