Class: SyntaxTree::EmbDoc
- Inherits:
-
Object
- Object
- SyntaxTree::EmbDoc
- Defined in:
- lib/syntax_tree.rb
Overview
EmbDoc represents a multi-line comment.
=begin
first line
second line
=end
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
- Location
-
the location of this node.
-
#value ⇒ Object
readonly
- String
-
the contents of the comment.
Instance Method Summary collapse
- #child_nodes ⇒ Object
- #comments ⇒ Object
- #format(q) ⇒ Object
- #ignore? ⇒ Boolean
-
#initialize(value:, location:) ⇒ EmbDoc
constructor
A new instance of EmbDoc.
- #inline? ⇒ Boolean
- #pretty_print(q) ⇒ Object
- #to_json(*opts) ⇒ Object
Constructor Details
#initialize(value:, location:) ⇒ EmbDoc
Returns a new instance of EmbDoc.
5615 5616 5617 5618 |
# File 'lib/syntax_tree.rb', line 5615 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
- Location
-
the location of this node
5613 5614 5615 |
# File 'lib/syntax_tree.rb', line 5613 def location @location end |
#value ⇒ Object (readonly)
- String
-
the contents of the comment
5610 5611 5612 |
# File 'lib/syntax_tree.rb', line 5610 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
5632 5633 5634 |
# File 'lib/syntax_tree.rb', line 5632 def child_nodes [] end |
#comments ⇒ Object
5628 5629 5630 |
# File 'lib/syntax_tree.rb', line 5628 def comments [] end |
#format(q) ⇒ Object
5636 5637 5638 5639 |
# File 'lib/syntax_tree.rb', line 5636 def format(q) q.trim q.text(value) end |
#ignore? ⇒ Boolean
5624 5625 5626 |
# File 'lib/syntax_tree.rb', line 5624 def ignore? false end |
#inline? ⇒ Boolean
5620 5621 5622 |
# File 'lib/syntax_tree.rb', line 5620 def inline? false end |
#pretty_print(q) ⇒ Object
5641 5642 5643 5644 5645 5646 5647 5648 |
# File 'lib/syntax_tree.rb', line 5641 def pretty_print(q) q.group(2, "(", ")") do q.text("embdoc") q.breakable q.pp(value) end end |
#to_json(*opts) ⇒ Object
5650 5651 5652 |
# File 'lib/syntax_tree.rb', line 5650 def to_json(*opts) { type: :embdoc, value: value, loc: location }.to_json(*opts) end |