Class: Peggy::Negative
- Defined in:
- lib/parse/builder.rb
Overview
Negative Predicate. If not found the original index is returned. If found NO_MATCH is returned.
Instance Attribute Summary
Attributes included from OneChild
Instance Method Summary collapse
-
#match(parser, index) ⇒ Object
Matches the child once.
-
#to_s ⇒ Object
Convert element to String.
Methods included from OneChild
Methods inherited from Element
Instance Method Details
#match(parser, index) ⇒ Object
Matches the child once. If not found the original index is returned. If found NO_MATCH is returned.
214 215 216 217 218 |
# File 'lib/parse/builder.rb', line 214 def match parser, index raise "negative element child not set" unless child found = child.match parser, index found ? NO_MATCH : index end |
#to_s ⇒ Object
Convert element to String.
221 222 223 |
# File 'lib/parse/builder.rb', line 221 def to_s "!#{wrap}" end |