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.



3719
3720
3721
3722
# File 'lib/syntax_tree/node.rb', line 3719

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

Instance Attribute Details

#valueObject (readonly)

String

the contents of the comment



3717
3718
3719
# File 'lib/syntax_tree/node.rb', line 3717

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



3736
3737
3738
# File 'lib/syntax_tree/node.rb', line 3736

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

#child_nodesObject Also known as: deconstruct



3740
3741
3742
# File 'lib/syntax_tree/node.rb', line 3740

def child_nodes
  []
end

#commentsObject



3732
3733
3734
# File 'lib/syntax_tree/node.rb', line 3732

def comments
  []
end

#deconstruct_keys(keys) ⇒ Object



3746
3747
3748
# File 'lib/syntax_tree/node.rb', line 3746

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

#format(q) ⇒ Object



3750
3751
3752
3753
# File 'lib/syntax_tree/node.rb', line 3750

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

#ignore?Boolean

Returns:

  • (Boolean)


3728
3729
3730
# File 'lib/syntax_tree/node.rb', line 3728

def ignore?
  false
end

#inline?Boolean

Returns:

  • (Boolean)


3724
3725
3726
# File 'lib/syntax_tree/node.rb', line 3724

def inline?
  false
end