Class: Jisota::CommandScript

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#commandObject

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