Class: YARP::XStringNode

Inherits:
YARPNode
  • Object
show all
Defined in:
lib/yarp/node.rb,
ext/yarp/api_node.c

Overview

Represents an xstring literal with no interpolation.

`foo`
^^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opening_loc, content_loc, closing_loc, unescaped, location) ⇒ XStringNode

def initialize: (opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String, location: Location) -> void



6300
6301
6302
6303
6304
6305
6306
# File 'lib/yarp/node.rb', line 6300

def initialize(opening_loc, content_loc, closing_loc, unescaped, location)
  @opening_loc = opening_loc
  @content_loc = content_loc
  @closing_loc = closing_loc
  @unescaped = unescaped
  @location = location
end

Instance Attribute Details

#closing_locObject (readonly)

attr_reader closing_loc: Location



6294
6295
6296
# File 'lib/yarp/node.rb', line 6294

def closing_loc
  @closing_loc
end

#content_locObject (readonly)

attr_reader content_loc: Location



6291
6292
6293
# File 'lib/yarp/node.rb', line 6291

def content_loc
  @content_loc
end

#opening_locObject (readonly)

attr_reader opening_loc: Location



6288
6289
6290
# File 'lib/yarp/node.rb', line 6288

def opening_loc
  @opening_loc
end

#unescapedObject (readonly)

attr_reader unescaped: String



6297
6298
6299
# File 'lib/yarp/node.rb', line 6297

def unescaped
  @unescaped
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



6309
6310
6311
# File 'lib/yarp/node.rb', line 6309

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

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array[nil | Node]



6314
6315
6316
# File 'lib/yarp/node.rb', line 6314

def child_nodes
  []
end

#closingObject

def closing: () -> String



6337
6338
6339
# File 'lib/yarp/node.rb', line 6337

def closing
  closing_loc.slice
end

#contentObject

def content: () -> String



6332
6333
6334
# File 'lib/yarp/node.rb', line 6332

def content
  content_loc.slice
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]



6322
6323
6324
# File 'lib/yarp/node.rb', line 6322

def deconstruct_keys(keys)
  { opening_loc: opening_loc, content_loc: content_loc, closing_loc: closing_loc, unescaped: unescaped, location: location }
end

#openingObject

def opening: () -> String



6327
6328
6329
# File 'lib/yarp/node.rb', line 6327

def opening
  opening_loc.slice
end