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.



4074
4075
4076
4077
# File 'lib/syntax_tree/node.rb', line 4074

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

Instance Attribute Details

#valueObject (readonly)

String

the contents of the comment



4072
4073
4074
# File 'lib/syntax_tree/node.rb', line 4072

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



4091
4092
4093
# File 'lib/syntax_tree/node.rb', line 4091

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

#child_nodesObject Also known as: deconstruct



4095
4096
4097
# File 'lib/syntax_tree/node.rb', line 4095

def child_nodes
  []
end

#commentsObject



4087
4088
4089
# File 'lib/syntax_tree/node.rb', line 4087

def comments
  []
end

#deconstruct_keys(keys) ⇒ Object



4101
4102
4103
# File 'lib/syntax_tree/node.rb', line 4101

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

#format(q) ⇒ Object



4105
4106
4107
4108
# File 'lib/syntax_tree/node.rb', line 4105

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

#ignore?Boolean

Returns:

  • (Boolean)


4083
4084
4085
# File 'lib/syntax_tree/node.rb', line 4083

def ignore?
  false
end

#inline?Boolean

Returns:

  • (Boolean)


4079
4080
4081
# File 'lib/syntax_tree/node.rb', line 4079

def inline?
  false
end