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.
585 586 587 588 |
# File 'lib/kpeg/grammar.rb', line 585 def initialize(op) super() @op = op end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
590 591 592 |
# File 'lib/kpeg/grammar.rb', line 590 def op @op end |
Instance Method Details
#==(obj) ⇒ Object
599 600 601 602 603 604 605 606 |
# File 'lib/kpeg/grammar.rb', line 599 def ==(obj) case obj when Collect @op == obj.op else super end end |
#inspect ⇒ Object
608 609 610 |
# File 'lib/kpeg/grammar.rb', line 608 def inspect inspect_type "collect", @op.inspect end |
#match(x) ⇒ Object
592 593 594 595 596 597 |
# File 'lib/kpeg/grammar.rb', line 592 def match(x) start = x.pos if @op.match(x) MatchString.new(self, x.string[start..x.pos]) end end |