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.



4111
4112
4113
4114
# File 'lib/syntax_tree/node.rb', line 4111

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

Instance Attribute Details

#valueObject (readonly)

String

the contents of the comment



4109
4110
4111
# File 'lib/syntax_tree/node.rb', line 4109

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



4128
4129
4130
# File 'lib/syntax_tree/node.rb', line 4128

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

#child_nodesObject Also known as: deconstruct



4132
4133
4134
# File 'lib/syntax_tree/node.rb', line 4132

def child_nodes
  []
end

#commentsObject



4124
4125
4126
# File 'lib/syntax_tree/node.rb', line 4124

def comments
  []
end

#deconstruct_keys(_keys) ⇒ Object



4138
4139
4140
# File 'lib/syntax_tree/node.rb', line 4138

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

#format(q) ⇒ Object



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

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

#ignore?Boolean

Returns:

  • (Boolean)


4120
4121
4122
# File 'lib/syntax_tree/node.rb', line 4120

def ignore?
  false
end

#inline?Boolean

Returns:

  • (Boolean)


4116
4117
4118
# File 'lib/syntax_tree/node.rb', line 4116

def inline?
  false
end