Class: Jisota::CommandScript
- Inherits:
-
Object
- Object
- Jisota::CommandScript
- Defined in:
- lib/jisota/command_script.rb
Overview
Part of the Script duck type
Stores a single shell command that can be executed
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
Instance Method Summary collapse
- #execute(context) ⇒ Object
-
#initialize(command) ⇒ CommandScript
constructor
A new instance of CommandScript.
Constructor Details
#initialize(command) ⇒ CommandScript
Returns a new instance of CommandScript.
9 10 11 |
# File 'lib/jisota/command_script.rb', line 9 def initialize(command) @command = command end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
7 8 9 |
# File 'lib/jisota/command_script.rb', line 7 def command @command end |
Instance Method Details
#execute(context) ⇒ Object
13 14 15 16 |
# File 'lib/jisota/command_script.rb', line 13 def execute(context) exit_code = context.command(command) exit_code == 0 end |