Class: SyntaxTree::EmbDoc
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::EmbDoc
show all
- Defined in:
- lib/syntax_tree/node.rb
Overview
EmbDoc represents a multi-line comment.
=begin
first line
second line
=end
Instance Attribute Summary collapse
Attributes inherited from Node
#location
Instance Method Summary
collapse
Methods inherited from Node
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ EmbDoc
Returns a new instance of EmbDoc.
4877
4878
4879
4880
|
# File 'lib/syntax_tree/node.rb', line 4877
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the contents of the comment
4875
4876
4877
|
# File 'lib/syntax_tree/node.rb', line 4875
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
4920
4921
4922
|
# File 'lib/syntax_tree/node.rb', line 4920
def ===(other)
other.is_a?(EmbDoc) && value === other.value
end
|
#accept(visitor) ⇒ Object
4894
4895
4896
|
# File 'lib/syntax_tree/node.rb', line 4894
def accept(visitor)
visitor.visit_embdoc(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
4898
4899
4900
|
# File 'lib/syntax_tree/node.rb', line 4898
def child_nodes
[]
end
|
4890
4891
4892
|
# File 'lib/syntax_tree/node.rb', line 4890
def
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
4902
4903
4904
4905
4906
4907
|
# File 'lib/syntax_tree/node.rb', line 4902
def copy(value: nil, location: nil)
EmbDoc.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
4911
4912
4913
|
# File 'lib/syntax_tree/node.rb', line 4911
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|
4915
4916
4917
4918
|
# File 'lib/syntax_tree/node.rb', line 4915
def format(q)
q.trim
q.text(value)
end
|
#ignore? ⇒ Boolean
4886
4887
4888
|
# File 'lib/syntax_tree/node.rb', line 4886
def ignore?
false
end
|
#inline? ⇒ Boolean
4882
4883
4884
|
# File 'lib/syntax_tree/node.rb', line 4882
def inline?
false
end
|