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.



4143
4144
4145
4146
# File 'lib/syntax_tree/node.rb', line 4143

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

Instance Attribute Details

#valueObject (readonly)

String

the contents of the comment



4141
4142
4143
# File 'lib/syntax_tree/node.rb', line 4141

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



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

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

#child_nodesObject Also known as: deconstruct



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

def child_nodes
  []
end

#commentsObject



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

def comments
  []
end

#deconstruct_keys(_keys) ⇒ Object



4170
4171
4172
# File 'lib/syntax_tree/node.rb', line 4170

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

#format(q) ⇒ Object



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

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

#ignore?Boolean

Returns:

  • (Boolean)


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

def ignore?
  false
end

#inline?Boolean

Returns:

  • (Boolean)


4148
4149
4150
# File 'lib/syntax_tree/node.rb', line 4148

def inline?
  false
end