Class: Peggy::Literal
- Defined in:
- lib/builder.rb,
lib/Copy of builder.rb
Overview
Matcher of a literal string or regular expression.
Instance Attribute Summary collapse
-
#value ⇒ Object
Value to match.
Instance Method Summary collapse
-
#initialize(value = nil) ⇒ Literal
constructor
Init the value.
-
#match(parser, index) ⇒ Object
Match the literal value.
- #to_s ⇒ Object
Methods inherited from Element
Constructor Details
#initialize(value = nil) ⇒ Literal
Init the value.
214 215 216 |
# File 'lib/builder.rb', line 214 def initialize value=nil @value = value end |
Instance Attribute Details
#value ⇒ Object
Value to match.
211 212 213 |
# File 'lib/builder.rb', line 211 def value @value end |
Instance Method Details
#match(parser, index) ⇒ Object
Match the literal value. If it matches the end index is returned. If no, NO_MATCH is returned.
227 228 229 |
# File 'lib/builder.rb', line 227 def match parser, index report parser.literal?(value, index) end |
#to_s ⇒ Object
231 232 233 |
# File 'lib/builder.rb', line 231 def to_s value.inspect end |