Class: Prepp::Command
Instance Attribute Summary collapse
-
#results ⇒ Object
Returns the value of attribute results.
Instance Method Summary collapse
- #execute(command = nil, &block) ⇒ Object
-
#initialize(name, *dependencies, &block) ⇒ Command
constructor
A new instance of Command.
- #to_s ⇒ Object
- #verify(command = nil, &block) ⇒ Object
Constructor Details
#initialize(name, *dependencies, &block) ⇒ Command
Returns a new instance of Command.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/prepp/commands/command.rb', line 4 def initialize(name, *dependencies, &block) @name = name.to_sym @dependencies = *dependencies @execute = [] @verifiers = [] @results = [] instance_eval(&block) end |
Instance Attribute Details
#results ⇒ Object
Returns the value of attribute results.
15 16 17 |
# File 'lib/prepp/commands/command.rb', line 15 def results @results end |
Instance Method Details
#execute(command = nil, &block) ⇒ Object
17 18 19 |
# File 'lib/prepp/commands/command.rb', line 17 def execute(command = nil, &block) @execute << (block_given? ? instance_eval(&block) : command) end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/prepp/commands/command.rb', line 25 def to_s build_ssh_command end |
#verify(command = nil, &block) ⇒ Object
21 22 23 |
# File 'lib/prepp/commands/command.rb', line 21 def verify(command = nil, &block) @verifiers << (block_given? ? instance_eval(&block) : command) end |