Class: Brandish::Execute Private
- Inherits:
-
Object
- Object
- Brandish::Execute
- Defined in:
- lib/brandish/execute.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Executes a string of code in the instance of the class.
Instance Method Summary collapse
-
#exec(code) ⇒ ::Object
private
Executes the given code in the context of the class.
-
#initialize(context) ⇒ Execute
constructor
private
Initialize the execution context.
Constructor Details
#initialize(context) ⇒ Execute
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the execution context.
14 15 16 |
# File 'lib/brandish/execute.rb', line 14 def initialize(context) context.each { |k, v| instance_variable_set(:"@#{k}", v) } end |
Instance Method Details
#exec(code) ⇒ ::Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Executes the given code in the context of the class.
22 23 24 |
# File 'lib/brandish/execute.rb', line 22 def exec(code) instance_exec(code) end |