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

#construct_keys, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ EmbDoc

Returns a new instance of EmbDoc.



4145
4146
4147
4148
# File 'lib/syntax_tree/node.rb', line 4145

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

Instance Attribute Details

#value ⇒ Object (readonly)

[String] the contents of the comment



4143
4144
4145
# File 'lib/syntax_tree/node.rb', line 4143

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



4162
4163
4164
# File 'lib/syntax_tree/node.rb', line 4162

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

#child_nodes ⇒ Object Also known as: deconstruct



4166
4167
4168
# File 'lib/syntax_tree/node.rb', line 4166

def child_nodes
  []
end

#comments ⇒ Object



4158
4159
4160
# File 'lib/syntax_tree/node.rb', line 4158

def comments
  []
end

#deconstruct_keys(_keys) ⇒ Object



4172
4173
4174
# File 'lib/syntax_tree/node.rb', line 4172

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

#format(q) ⇒ Object



4176
4177
4178
4179
# File 'lib/syntax_tree/node.rb', line 4176

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

#ignore? ⇒ Boolean

Returns:

  • (Boolean)


4154
4155
4156
# File 'lib/syntax_tree/node.rb', line 4154

def ignore?
  false
end

#inline? ⇒ Boolean

Returns:

  • (Boolean)


4150
4151
4152
# File 'lib/syntax_tree/node.rb', line 4150

def inline?
  false
end