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.
516 517 518 |
# File 'lib/kpeg/grammar.rb', line 516 def op @op end |
#tag_name ⇒ Object (readonly)
Returns the value of attribute tag_name.
516 517 518 |
# File 'lib/kpeg/grammar.rb', line 516 def tag_name @tag_name end |
Instance Method Details
#==(obj) ⇒ Object
524 525 526 527 528 529 530 531 532 533 |
# File 'lib/kpeg/grammar.rb', line 524 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
535 536 537 538 539 540 541 542 543 544 545 |
# File 'lib/kpeg/grammar.rb', line 535 def inspect if @tag_name body = "@#{tag_name} " else body = "" end body << @op.inspect inspect_type "tag", body end |
#match(x) ⇒ Object
518 519 520 521 522 |
# File 'lib/kpeg/grammar.rb', line 518 def match(x) if m = @op.match(x) MatchComposition.new(self, [m]) end end |