Class: Lexr::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/lexr.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern, symbol, opts = {}) ⇒ Rule



84
85
86
# File 'lib/lexr.rb', line 84

def initialize(pattern, symbol, opts = {})
  @pattern, @symbol, @opts = pattern, symbol, opts
end

Instance Attribute Details

#patternObject (readonly)

Returns the value of attribute pattern.



79
80
81
# File 'lib/lexr.rb', line 79

def pattern
  @pattern
end

#symbolObject (readonly)

Returns the value of attribute symbol.



79
80
81
# File 'lib/lexr.rb', line 79

def symbol
  @symbol
end

Instance Method Details

#==(other) ⇒ Object



88
89
90
91
92
93
# File 'lib/lexr.rb', line 88

def ==(other)
  @pattern == other.pattern && 
    @symbol == other.symbol && 
    @opts[:convert_with] == other.converter && 
    @opts[:ignore] == other.ignore?
end

#converterObject



81
# File 'lib/lexr.rb', line 81

def converter ; @opts[:convert_with] ; end

#ignore?Boolean



82
# File 'lib/lexr.rb', line 82

def ignore? ; @opts[:ignore] ; end