Class: Gat::Action::ShellCommandChild

Inherits:
Object
  • Object
show all
Includes:
Interpreter
Defined in:
lib/gat/action/shell_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Interpreter

#interpreter_parameter, #interpreter_parameters, #interpreter_shell_command

Constructor Details

#initialize(parent, values) ⇒ ShellCommandChild

Returns a new instance of ShellCommandChild.



165
166
167
168
169
170
171
172
# File 'lib/gat/action/shell_command.rb', line 165

def initialize(parent, values)
 @parent    = parent
 @values    = values


 @syntax    = parent.syntax
 @name      = "#{ parent.name }*over* #{ values.values.join("_") }"
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



162
163
164
# File 'lib/gat/action/shell_command.rb', line 162

def arguments
  @arguments
end

#nameObject (readonly)

Returns the value of attribute name.



159
160
161
# File 'lib/gat/action/shell_command.rb', line 159

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



156
157
158
# File 'lib/gat/action/shell_command.rb', line 156

def parent
  @parent
end

#syntaxObject

Returns the value of attribute syntax.



157
158
159
# File 'lib/gat/action/shell_command.rb', line 157

def syntax
  @syntax
end

#valuesObject (readonly)

Returns the value of attribute values.



158
159
160
# File 'lib/gat/action/shell_command.rb', line 158

def values
  @values
end

Instance Method Details

#execObject



174
175
176
177
178
179
180
181
182
# File 'lib/gat/action/shell_command.rb', line 174

def exec
 # make the substitution of each parameter and exec like other action
 values.each_pair do |parameter_key, parameter_value |
   self.syntax = self.syntax.gsub(/\{\{#{ parameter_key }\}\}/, parameter_value)
 end

 parse_syntax = interpreter_parameters(self.syntax, self.parent.operation.gatget)
  self.parent.exec(parse_syntax, " *over* #{ values.values.join("_") }")
end