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.
4872
4873
4874
4875
|
# File 'lib/syntax_tree/node.rb', line 4872
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the contents of the comment
4870
4871
4872
|
# File 'lib/syntax_tree/node.rb', line 4870
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
4915
4916
4917
|
# File 'lib/syntax_tree/node.rb', line 4915
def ===(other)
other.is_a?(EmbDoc) && value === other.value
end
|
#accept(visitor) ⇒ Object
4889
4890
4891
|
# File 'lib/syntax_tree/node.rb', line 4889
def accept(visitor)
visitor.visit_embdoc(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
4893
4894
4895
|
# File 'lib/syntax_tree/node.rb', line 4893
def child_nodes
[]
end
|
4885
4886
4887
|
# File 'lib/syntax_tree/node.rb', line 4885
def
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
4897
4898
4899
4900
4901
4902
|
# File 'lib/syntax_tree/node.rb', line 4897
def copy(value: nil, location: nil)
EmbDoc.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
4906
4907
4908
|
# File 'lib/syntax_tree/node.rb', line 4906
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|
4910
4911
4912
4913
|
# File 'lib/syntax_tree/node.rb', line 4910
def format(q)
q.trim
q.text(value)
end
|
#ignore? ⇒ Boolean
4881
4882
4883
|
# File 'lib/syntax_tree/node.rb', line 4881
def ignore?
false
end
|
#inline? ⇒ Boolean
4877
4878
4879
|
# File 'lib/syntax_tree/node.rb', line 4877
def inline?
false
end
|