class SyntaxTree::StringDVar
“#@variable”
variable and omit the braces when interpolating.
It allows you to take an instance variable, class variable, or global
StringDVar represents shorthand interpolation of a variable into a string.
def ===(other)
def ===(other) other.is_a?(StringDVar) && variable === other.variable end
def accept(visitor)
def accept(visitor) visitor.visit_string_dvar(self) end
def child_nodes
def child_nodes [variable] end
def copy(variable: nil, location: nil)
def copy(variable: nil, location: nil) node = StringDVar.new( variable: variable || self.variable, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { variable: variable, location: location, comments: comments } end
def format(q)
def format(q) q.text('#{') q.format(variable) q.text("}") end
def initialize(variable:, location:)
def initialize(variable:, location:) @variable = variable @location = location @comments = [] end