Class: Scripted::Commands::Ruby
- Inherits:
-
Object
- Object
- Scripted::Commands::Ruby
- Defined in:
- lib/scripted/commands/ruby.rb
Instance Method Summary collapse
- #execute!(log = STDOUT) ⇒ Object
-
#initialize(code) ⇒ Ruby
constructor
A new instance of Ruby.
Constructor Details
#initialize(code) ⇒ Ruby
Returns a new instance of Ruby.
5 6 7 |
# File 'lib/scripted/commands/ruby.rb', line 5 def initialize(code) @code = code end |
Instance Method Details
#execute!(log = STDOUT) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/scripted/commands/ruby.rb', line 9 def execute!(log = STDOUT) old_stdout = $stdout old_stderr = $stderr $stdout = log $stderr = log @code.call ensure $stdout = old_stdout $stderr = old_stderr end |