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.



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

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

Instance Attribute Details

#valueObject (readonly)

String

the contents of the comment



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

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



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

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

#child_nodesObject Also known as: deconstruct



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

def child_nodes
  []
end

#commentsObject



4168
4169
4170
# File 'lib/syntax_tree/node.rb', line 4168

def comments
  []
end

#deconstruct_keys(_keys) ⇒ Object



4182
4183
4184
# File 'lib/syntax_tree/node.rb', line 4182

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

#format(q) ⇒ Object



4186
4187
4188
4189
# File 'lib/syntax_tree/node.rb', line 4186

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

#ignore?Boolean

Returns:

  • (Boolean)


4164
4165
4166
# File 'lib/syntax_tree/node.rb', line 4164

def ignore?
  false
end

#inline?Boolean

Returns:

  • (Boolean)


4160
4161
4162
# File 'lib/syntax_tree/node.rb', line 4160

def inline?
  false
end