Class: RainforestRubyRuntime::DSL
- Inherits:
-
Object
- Object
- RainforestRubyRuntime::DSL
- Defined in:
- lib/rainforest_ruby_runtime/dsl.rb
Instance Method Summary collapse
- #define_variable_scope(name, &block) ⇒ Object
-
#initialize(callback:) ⇒ DSL
constructor
A new instance of DSL.
- #run_code(code) ⇒ Object
- #test(id:, title:, &block) ⇒ Object
Constructor Details
#initialize(callback:) ⇒ DSL
Returns a new instance of DSL.
3 4 5 |
# File 'lib/rainforest_ruby_runtime/dsl.rb', line 3 def initialize(callback: ) @callback = callback end |
Instance Method Details
#define_variable_scope(name, &block) ⇒ Object
11 12 13 14 |
# File 'lib/rainforest_ruby_runtime/dsl.rb', line 11 def define_variable_scope(name, &block) scope = Variables::Scope.new(name, &block) Variables.scope_registery.register(scope) end |
#run_code(code) ⇒ Object
16 17 18 |
# File 'lib/rainforest_ruby_runtime/dsl.rb', line 16 def run_code(code) eval(code) end |
#test(id:, title:, &block) ⇒ Object
7 8 9 |
# File 'lib/rainforest_ruby_runtime/dsl.rb', line 7 def test(id: , title: , &block) RainforestRubyRuntime::Test.new(id: id, title: title, callback: @callback, &block) end |