Class: Prism::StringNode

Inherits:
Node
  • Object
show all
Defined in:
lib/prism/node_ext.rb

Instance Method Summary collapse

Methods inherited from Node

#deprecated, #newline_flag!, #newline_flag?

Instance Method Details

#to_interpolatedObject

Occasionally it’s helpful to treat a string as if it were interpolated so that there’s a consistent interface for working with strings.



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/prism/node_ext.rb', line 72

def to_interpolated
  InterpolatedStringNode.new(
    source,
    -1,
    location,
    frozen? ? InterpolatedStringNodeFlags::FROZEN : 0,
    opening_loc,
    [copy(location: content_loc, opening_loc: nil, closing_loc: nil)],
    closing_loc
  )
end