Class: DSLCompose::DSL::Arguments::Argument::Interpreter

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

Overview

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

This class is instantaited by the DSLCompose::DSL::Arguments::Argument class and the method argument 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 method definition with complex arguments:

define_dsl :my_dsl do
  add_method :my_method, required: true do
    description "Description of my method"
    optional :my_optional_argument, :string do
      description "A description of this argument"
      validate_greater_than 10
    end
    optional :my_optional_arg, String
  end
end

Instance Method Summary collapse

Constructor Details

#initialize(argument) ⇒ Interpreter

Returns a new instance of Interpreter.



27
28
29
# File 'lib/dsl_compose/dsl/arguments/argument/interpreter.rb', line 27

def initialize argument
  @argument = argument
end