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.



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

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

Instance Attribute Details

#valueObject (readonly)

String

the contents of the comment



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

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



4200
4201
4202
# File 'lib/syntax_tree/node.rb', line 4200

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

#child_nodesObject Also known as: deconstruct



4204
4205
4206
# File 'lib/syntax_tree/node.rb', line 4204

def child_nodes
  []
end

#commentsObject



4196
4197
4198
# File 'lib/syntax_tree/node.rb', line 4196

def comments
  []
end

#deconstruct_keys(_keys) ⇒ Object



4210
4211
4212
# File 'lib/syntax_tree/node.rb', line 4210

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

#format(q) ⇒ Object



4214
4215
4216
4217
# File 'lib/syntax_tree/node.rb', line 4214

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

#ignore?Boolean

Returns:

  • (Boolean)


4192
4193
4194
# File 'lib/syntax_tree/node.rb', line 4192

def ignore?
  false
end

#inline?Boolean

Returns:

  • (Boolean)


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

def inline?
  false
end