Class: Stamina::Engine
- Inherits:
-
Object
- Object
- Stamina::Engine
- Defined in:
- lib/stamina-core/stamina/engine.rb,
lib/stamina-core/stamina/engine/context.rb
Defined Under Namespace
Classes: Context
Class Method Summary collapse
Instance Method Summary collapse
- #execute(code, file = nil) ⇒ Object
- #execute_binding ⇒ Object
-
#initialize ⇒ Engine
constructor
A new instance of Engine.
Constructor Details
Class Method Details
.execute(*args) ⇒ Object
27 28 29 |
# File 'lib/stamina-core/stamina/engine.rb', line 27 def self.execute(*args) new.execute(*args) end |
Instance Method Details
#execute(code, file = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/stamina-core/stamina/engine.rb', line 13 def execute(code, file = nil) code = <<-EOF main = begin #{code} end Context.new(local_variables, binding) EOF if file eval(code, execute_binding, file) else eval(code, execute_binding) end end |
#execute_binding ⇒ Object
9 10 11 |
# File 'lib/stamina-core/stamina/engine.rb', line 9 def execute_binding binding end |