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.



4292
4293
4294
4295
# File 'lib/syntax_tree/node.rb', line 4292

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

Instance Attribute Details

#valueObject (readonly)

String

the contents of the comment



4290
4291
4292
# File 'lib/syntax_tree/node.rb', line 4290

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



4309
4310
4311
# File 'lib/syntax_tree/node.rb', line 4309

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

#child_nodesObject Also known as: deconstruct



4313
4314
4315
# File 'lib/syntax_tree/node.rb', line 4313

def child_nodes
  []
end

#commentsObject



4305
4306
4307
# File 'lib/syntax_tree/node.rb', line 4305

def comments
  []
end

#deconstruct_keys(_keys) ⇒ Object



4319
4320
4321
# File 'lib/syntax_tree/node.rb', line 4319

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

#format(q) ⇒ Object



4323
4324
4325
4326
# File 'lib/syntax_tree/node.rb', line 4323

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

#ignore?Boolean

Returns:

  • (Boolean)


4301
4302
4303
# File 'lib/syntax_tree/node.rb', line 4301

def ignore?
  false
end

#inline?Boolean

Returns:

  • (Boolean)


4297
4298
4299
# File 'lib/syntax_tree/node.rb', line 4297

def inline?
  false
end