Class: DSLCompose::DSL::DSLMethod::Interpreter

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

Overview

This class is reponsible for parsing and executing method definitions within our internal DSL. These method definitions determine what methods will be available within our new dynamic DSL.

This class is instantaited by the DSLCompose::DSL::DSLMethod class and the method definition part of our internal DSL is evaluated by passing a block to ‘instance_eval` on this class.

An example of our internal DSL which includes a complex method definition:

define_dsl :my_dsl do
  add_method :my_method, required: true do
    description "Description of my method"
    optional :my_optional_argument, :string do
      # ...
    end
    optional :my_optional_arg, String
  end
end

Instance Method Summary collapse

Constructor Details

#initialize(dsl_method) ⇒ Interpreter

Returns a new instance of Interpreter.



24
25
26
# File 'lib/dsl_compose/dsl/dsl_method/interpreter.rb', line 24

def initialize dsl_method
  @dsl_method = dsl_method
end