Class: Gat::Action::RubyMethod

Inherits:
Base
  • Object
show all
Defined in:
lib/gat/action/ruby_method.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#argument, #config, #description, #error, #errors, #exit_level, #flags, #name, #onfail, #onfail_callback, #onfail_message, #operation, #output, #parsed_syntax, #times

Instance Method Summary collapse

Methods inherited from Base

#execute, #execute?, get_current_action, #initialize

Methods included from Interpreter

#interpreter_parameter, #interpreter_parameters, #interpreter_shell_command

Constructor Details

This class inherits a constructor from Gat::Action::Base

Instance Attribute Details

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/gat/action/ruby_method.rb', line 6

def status
  @status
end

Instance Method Details

#execObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gat/action/ruby_method.rb', line 15

def exec
 self.operation.gatget.logger.log("trace", "action_syntax", "Action #{ self.name }  exec ruby method." )
 self.times['init'] ||= Time.now

 begin
   self.operation.gatget.send(self.name)
   self.status     = 'ok'
   self.exit_level = 0
 rescue => e
   self.error = e
   self.status     = 'failed'
   self.exit_level = 1
 end

 self.times['end'] ||= Time.now
  self.exit_level
end

#runObject



8
9
10
11
12
# File 'lib/gat/action/ruby_method.rb', line 8

def run

	self.exec

end