28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/walrus/grammar/placeholder.rb', line 28
def compile options = {}
if options[:nest_placeholders] == true
method_name = "lookup_and_return_placeholder" else
method_name = "lookup_and_accumulate_placeholder" end
if @params == []
"#{method_name}(#{@name.to_s.to_sym.inspect})\n"
else
options = options.clone
options[:nest_placeholders] = true
params = (@params.kind_of? Array) ? @params : [@params]
param_list = params.map { |param| param.compile(options) }.join(', ').chomp
"#{method_name}(#{@name.to_s.to_sym.inspect}, #{param_list})\n"
end
end
|