Class: SyntaxTree::EmbDoc

Inherits:
Node
  • Object
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

#pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ EmbDoc

Returns a new instance of EmbDoc.



4073
4074
4075
4076
# File 'lib/syntax_tree/node.rb', line 4073

def initialize(value:, location:)
  @value = value
  @location = location
end

Instance Attribute Details

#valueObject (readonly)

String

the contents of the comment



4071
4072
4073
# File 'lib/syntax_tree/node.rb', line 4071

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



4090
4091
4092
# File 'lib/syntax_tree/node.rb', line 4090

def accept(visitor)
  visitor.visit_embdoc(self)
end

#child_nodesObject Also known as: deconstruct



4094
4095
4096
# File 'lib/syntax_tree/node.rb', line 4094

def child_nodes
  []
end

#commentsObject



4086
4087
4088
# File 'lib/syntax_tree/node.rb', line 4086

def comments
  []
end

#deconstruct_keys(keys) ⇒ Object



4100
4101
4102
# File 'lib/syntax_tree/node.rb', line 4100

def deconstruct_keys(keys)
  { value: value, location: location }
end

#format(q) ⇒ Object



4104
4105
4106
4107
# File 'lib/syntax_tree/node.rb', line 4104

def format(q)
  q.trim
  q.text(value)
end

#ignore?Boolean

Returns:

  • (Boolean)


4082
4083
4084
# File 'lib/syntax_tree/node.rb', line 4082

def ignore?
  false
end

#inline?Boolean

Returns:

  • (Boolean)


4078
4079
4080
# File 'lib/syntax_tree/node.rb', line 4078

def inline?
  false
end