Class: Lexr::Rule
- Inherits:
-
Object
- Object
- Lexr::Rule
- Defined in:
- lib/lexr.rb
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #converter ⇒ Object
- #ignore? ⇒ Boolean
-
#initialize(pattern, symbol, opts = {}) ⇒ Rule
constructor
A new instance of Rule.
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
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
79 80 81 |
# File 'lib/lexr.rb', line 79 def pattern @pattern end |
#symbol ⇒ Object (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 |
#converter ⇒ Object
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 |