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.



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

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

Instance Attribute Details

#valueObject (readonly)

String

the contents of the comment



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

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



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

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

#child_nodesObject Also known as: deconstruct



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

def child_nodes
  []
end

#commentsObject



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

def comments
  []
end

#deconstruct_keys(_keys) ⇒ Object



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

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

#format(q) ⇒ Object



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

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

#ignore?Boolean

Returns:

  • (Boolean)


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

def ignore?
  false
end

#inline?Boolean

Returns:

  • (Boolean)


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

def inline?
  false
end