Class: Rubu::RubyCommand
Overview
Ruby based command.
Instance Attribute Summary
Attributes inherited from Action
#errmsg, #output, #status, #subs
Instance Method Summary collapse
-
#initialize(desc = nil, &cmd) ⇒ RubyCommand
constructor
A new instance of RubyCommand.
- #run ⇒ Object
Methods inherited from Action
#display, #error, #host, #host_in, #host_out, #pick, #use
Constructor Details
#initialize(desc = nil, &cmd) ⇒ RubyCommand
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
#run ⇒ Object
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 |