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



6254
6255
6256
6257
6258
6259
6260
# File 'lib/yarp/node.rb', line 6254

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



6248
6249
6250
# File 'lib/yarp/node.rb', line 6248

def closing_loc
  @closing_loc
end

#content_locObject (readonly)

attr_reader content_loc: Location



6245
6246
6247
# File 'lib/yarp/node.rb', line 6245

def content_loc
  @content_loc
end

#opening_locObject (readonly)

attr_reader opening_loc: Location



6242
6243
6244
# File 'lib/yarp/node.rb', line 6242

def opening_loc
  @opening_loc
end

#unescapedObject (readonly)

attr_reader unescaped: String



6251
6252
6253
# File 'lib/yarp/node.rb', line 6251

def unescaped
  @unescaped
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



6263
6264
6265
# File 'lib/yarp/node.rb', line 6263

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

#child_nodesObject Also known as: deconstruct

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



6269
6270
6271
# File 'lib/yarp/node.rb', line 6269

def child_nodes
  []
end

#closingObject

def closing: () -> String



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

def closing
  closing_loc.slice
end

#contentObject

def content: () -> String



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

def content
  content_loc.slice
end

#deconstruct_keys(keys) ⇒ Object

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



6277
6278
6279
# File 'lib/yarp/node.rb', line 6277

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



6282
6283
6284
# File 'lib/yarp/node.rb', line 6282

def opening
  opening_loc.slice
end