Method: Red::CallNode::Yield#initialize

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

#initialize(arguments_array_sexp = nil, options = {}) ⇒ Yield

:yield, (expression | :array, expression, expression, …)


141
142
143
144
145
146
147
# File 'lib/red/nodes/call_nodes.rb', line 141

def initialize(arguments_array_sexp = nil, options = {})
  (options = arguments_array_sexp) && (arguments_array_sexp = [:array]) if arguments_array_sexp.is_a?(Hash)
  argument_sexps = arguments_array_sexp.is_sexp?(:array) ? arguments_array_sexp[1..-1] || [] : [arguments_array_sexp]
  args_array     = argument_sexps.map {|argument_sexp| argument_sexp.red!(:as_argument => true)}
  arguments      = args_array.join(",")
  self << "%s.m$call(%s)" % [@@red_block_arg, arguments]
end