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.
5446 5447 5448 5449 |
# File 'lib/syntax_tree.rb', line 5446 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
- Location
-
the location of this node
5444 5445 5446 |
# File 'lib/syntax_tree.rb', line 5444 def location @location end |
#value ⇒ Object (readonly)
- String
-
the contents of the comment
5441 5442 5443 |
# File 'lib/syntax_tree.rb', line 5441 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
5463 5464 5465 |
# File 'lib/syntax_tree.rb', line 5463 def child_nodes [] end |
#comments ⇒ Object
5459 5460 5461 |
# File 'lib/syntax_tree.rb', line 5459 def comments [] end |
#format(q) ⇒ Object
5467 5468 5469 5470 |
# File 'lib/syntax_tree.rb', line 5467 def format(q) q.trim q.text(value) end |
#ignore? ⇒ Boolean
5455 5456 5457 |
# File 'lib/syntax_tree.rb', line 5455 def ignore? false end |
#inline? ⇒ Boolean
5451 5452 5453 |
# File 'lib/syntax_tree.rb', line 5451 def inline? false end |
#pretty_print(q) ⇒ Object
5472 5473 5474 5475 5476 5477 5478 5479 |
# File 'lib/syntax_tree.rb', line 5472 def pretty_print(q) q.group(2, "(", ")") do q.text("embdoc") q.breakable q.pp(value) end end |
#to_json(*opts) ⇒ Object
5481 5482 5483 |
# File 'lib/syntax_tree.rb', line 5481 def to_json(*opts) { type: :embdoc, value: value, loc: location }.to_json(*opts) end |