Class: KPeg::Tag
Instance Attribute Summary collapse
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#tag_name ⇒ Object
readonly
Returns the value of attribute tag_name.
Attributes inherited from Operator
Instance Method Summary collapse
- #==(obj) ⇒ Object
-
#initialize(op, tag_name) ⇒ Tag
constructor
A new instance of Tag.
- #inspect ⇒ Object
- #match(x) ⇒ Object
Methods inherited from Operator
#detect_tags, #inspect_type, #prune_values, #set_action, #|
Constructor Details
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
526 527 528 |
# File 'lib/kpeg/grammar.rb', line 526 def op @op end |
#tag_name ⇒ Object (readonly)
Returns the value of attribute tag_name.
526 527 528 |
# File 'lib/kpeg/grammar.rb', line 526 def tag_name @tag_name end |
Instance Method Details
#==(obj) ⇒ Object
534 535 536 537 538 539 540 541 542 543 |
# File 'lib/kpeg/grammar.rb', line 534 def ==(obj) case obj when Tag @op == obj.op and @tag_name == obj.tag_name when Operator @op == obj else super end end |
#inspect ⇒ Object
545 546 547 548 549 550 551 552 553 554 555 |
# File 'lib/kpeg/grammar.rb', line 545 def inspect if @tag_name body = "@#{tag_name} " else body = "" end body << @op.inspect inspect_type "tag", body end |
#match(x) ⇒ Object
528 529 530 531 532 |
# File 'lib/kpeg/grammar.rb', line 528 def match(x) if m = @op.match(x) MatchComposition.new(self, [m]) end end |