Class: Fleetctl::Command
- Inherits:
-
Object
- Object
- Fleetctl::Command
- Defined in:
- lib/fleetctl/command.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*cmd) {|runner| ... } ⇒ Command
constructor
A new instance of Command.
- #run(*args) ⇒ Object
- #runner ⇒ Object
Constructor Details
#initialize(*cmd) {|runner| ... } ⇒ Command
Returns a new instance of Command.
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
#command ⇒ Object
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 |
#runner ⇒ Object
22 23 24 25 |
# File 'lib/fleetctl/command.rb', line 22 def runner klass = "Fleetctl::Runner::#{Fleetctl..runner_class}".constantize @runner ||= klass.new(expression) end |