Method: Red::LiteralNode::String#initialize

Defined in:
lib/red/nodes/literal_nodes.rb

#initialize(*element_sexps) ⇒ String

:str, “foo”
:dstr, “foo”, expression, expression, …
:evstr, expression


119
120
121
122
123
124
# File 'lib/red/nodes/literal_nodes.rb', line 119

def initialize(*element_sexps)
  options  = element_sexps.pop
  elements = element_sexps.map {|element_sexp| element_sexp.red!(options.merge(:as_argument => true, :as_string_element => true)) }.join(",")
  string   = options[:unquoted] || options[:as_string_element] ? "%s" : element_sexps.size > 1 ? "$Q(%s)" : "$q(%s)"
  self << string % [elements]
end