Class: DSLCompose::DSL::Interpreter

Inherits:
Object
  • Object
show all
Defined in:
lib/dsl_compose/dsl/interpreter.rb

Overview

The class is reponsible for parsing and executing our internal DSL which is used to define a new dynamic DSL. This class is instantaited by the DSLCompose::DSL class and our internal DSL is evaluated by passing a block to ‘instance_eval` on this class.

An example of our internal DSL:

define_dsl :my_dsl do
  description "This is my DSL"
  add_method :my_method do
    # ...
  end
  add_unique_method :my_uniq_method do
    # ...
  end
end

Instance Method Summary collapse

Constructor Details

#initialize(dsl) ⇒ Interpreter

Returns a new instance of Interpreter.



20
21
22
# File 'lib/dsl_compose/dsl/interpreter.rb', line 20

def initialize dsl
  @dsl = dsl
end