Class: SyntaxTree::EmbDoc
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 (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.
4809 4810 4811 4812 |
# File 'lib/syntax_tree/node.rb', line 4809 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
- Location
-
the location of this node
4807 4808 4809 |
# File 'lib/syntax_tree/node.rb', line 4807 def location @location end |
#value ⇒ Object (readonly)
- String
-
the contents of the comment
4804 4805 4806 |
# File 'lib/syntax_tree/node.rb', line 4804 def value @value end |
Instance Method Details
#child_nodes ⇒ Object Also known as: deconstruct
4826 4827 4828 |
# File 'lib/syntax_tree/node.rb', line 4826 def child_nodes [] end |
#comments ⇒ Object
4822 4823 4824 |
# File 'lib/syntax_tree/node.rb', line 4822 def comments [] end |
#deconstruct_keys(keys) ⇒ Object
4832 4833 4834 |
# File 'lib/syntax_tree/node.rb', line 4832 def deconstruct_keys(keys) { value: value, location: location } end |
#format(q) ⇒ Object
4836 4837 4838 4839 |
# File 'lib/syntax_tree/node.rb', line 4836 def format(q) q.trim q.text(value) end |
#ignore? ⇒ Boolean
4818 4819 4820 |
# File 'lib/syntax_tree/node.rb', line 4818 def ignore? false end |
#inline? ⇒ Boolean
4814 4815 4816 |
# File 'lib/syntax_tree/node.rb', line 4814 def inline? false end |
#pretty_print(q) ⇒ Object
4841 4842 4843 4844 4845 4846 4847 4848 |
# File 'lib/syntax_tree/node.rb', line 4841 def pretty_print(q) q.group(2, "(", ")") do q.text("embdoc") q.breakable q.pp(value) end end |
#to_json(*opts) ⇒ Object
4850 4851 4852 |
# File 'lib/syntax_tree/node.rb', line 4850 def to_json(*opts) { type: :embdoc, value: value, loc: location }.to_json(*opts) end |