Module: Lex::Lexer::DSL::ClassMethods Private

Defined in:
lib/lex/lexer/dsl.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class methods for a lexer

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Delegate calls to RuleDSL



39
40
41
42
43
44
45
# File 'lib/lex/lexer/dsl.rb', line 39

def method_missing(name, *args, &block)
  if dsl.respond_to?(name)
    dsl.public_send(name, *args, &block)
  else
    super
  end
end

Instance Method Details

#dslObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return the rule DSL used by Lexer



32
33
34
# File 'lib/lex/lexer/dsl.rb', line 32

def dsl
  @dsl ||= RuleDSL.new
end

#inherited(klass) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Set dsl for lexer



23
24
25
26
27
# File 'lib/lex/lexer/dsl.rb', line 23

def inherited(klass)
  super

  klass.instance_variable_set('@dsl', nil)
end