Class: Rubu::RubyCommand
Overview
Ruby based command.
Instance Attribute Summary
Attributes inherited from Action
#errmsg, #output, #status, #subs
Instance Method Summary (collapse)
-
- (RubyCommand) initialize(desc = nil, &cmd)
constructor
A new instance of RubyCommand.
- - (Object) run
Methods inherited from Action
#display, #error, #host, #host_in, #host_out, #pick, #use
Constructor Details
- (RubyCommand) initialize(desc = nil, &cmd)
Returns a new instance of RubyCommand
150 151 152 153 154 |
# File 'lib/rubu.rb', line 150 def initialize( desc = nil, &cmd ) super() @desc = desc @cmd = cmd end |
Instance Method Details
- (Object) run
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/rubu.rb', line 156 def run begin ret = instance_eval( &@cmd ) @status = :success if @desc && Order[ :verbose ] STDOUT.puts @desc end rescue => f @status = :error error( f.backtrace.join("\n") ) end self end |