Class: KPeg::Collect
Instance Attribute Summary collapse
-
#op ⇒ Object
readonly
Returns the value of attribute op.
Attributes inherited from Operator
Instance Method Summary collapse
- #==(obj) ⇒ Object
-
#initialize(op) ⇒ Collect
constructor
A new instance of Collect.
- #inspect ⇒ Object
- #match(x) ⇒ Object
Methods inherited from Operator
#detect_tags, #inspect_type, #prune_values, #set_action, #|
Constructor Details
#initialize(op) ⇒ Collect
Returns a new instance of Collect.
575 576 577 578 |
# File 'lib/kpeg/grammar.rb', line 575 def initialize(op) super() @op = op end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
580 581 582 |
# File 'lib/kpeg/grammar.rb', line 580 def op @op end |
Instance Method Details
#==(obj) ⇒ Object
589 590 591 592 593 594 595 596 |
# File 'lib/kpeg/grammar.rb', line 589 def ==(obj) case obj when Collect @op == obj.op else super end end |
#inspect ⇒ Object
598 599 600 |
# File 'lib/kpeg/grammar.rb', line 598 def inspect inspect_type "collect", @op.inspect end |
#match(x) ⇒ Object
582 583 584 585 586 587 |
# File 'lib/kpeg/grammar.rb', line 582 def match(x) start = x.pos if @op.match(x) MatchString.new(self, x.string[start..x.pos]) end end |