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.



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

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.



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

def arguments
  @arguments
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



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

def parent
  @parent
end

#syntaxObject

Returns the value of attribute syntax.



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

def syntax
  @syntax
end

#valuesObject (readonly)

Returns the value of attribute values.



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

def values
  @values
end

Instance Method Details

#execObject



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

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