Class: SyntaxTree::EmbDoc
Overview
EmbDoc represents a multi-line comment.
=begin
first line
second line
=end
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- String
-
the contents of the comment.
Attributes inherited from Node
Instance Method Summary collapse
- #child_nodes ⇒ Object (also: #deconstruct)
- #comments ⇒ Object
- #deconstruct_keys(keys) ⇒ 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.
4656 4657 4658 4659 |
# File 'lib/syntax_tree/node.rb', line 4656 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the contents of the comment
4654 4655 4656 |
# File 'lib/syntax_tree/node.rb', line 4654 def value @value end |
Instance Method Details
#child_nodes ⇒ Object Also known as: deconstruct
4673 4674 4675 |
# File 'lib/syntax_tree/node.rb', line 4673 def child_nodes [] end |
#comments ⇒ Object
4669 4670 4671 |
# File 'lib/syntax_tree/node.rb', line 4669 def comments [] end |
#deconstruct_keys(keys) ⇒ Object
4679 4680 4681 |
# File 'lib/syntax_tree/node.rb', line 4679 def deconstruct_keys(keys) { value: value, location: location } end |
#format(q) ⇒ Object
4683 4684 4685 4686 |
# File 'lib/syntax_tree/node.rb', line 4683 def format(q) q.trim q.text(value) end |
#ignore? ⇒ Boolean
4665 4666 4667 |
# File 'lib/syntax_tree/node.rb', line 4665 def ignore? false end |
#inline? ⇒ Boolean
4661 4662 4663 |
# File 'lib/syntax_tree/node.rb', line 4661 def inline? false end |
#pretty_print(q) ⇒ Object
4688 4689 4690 4691 4692 4693 4694 4695 |
# File 'lib/syntax_tree/node.rb', line 4688 def pretty_print(q) q.group(2, "(", ")") do q.text("embdoc") q.breakable q.pp(value) end end |
#to_json(*opts) ⇒ Object
4697 4698 4699 |
# File 'lib/syntax_tree/node.rb', line 4697 def to_json(*opts) { type: :embdoc, value: value, loc: location }.to_json(*opts) end |