class Jcompiler::Provider def object!(arg_name = nil, &block) srcs, subst_src = if arg_name [block.call(nil), "#{block.parameters[0][1]}=#{arg_name};"] else [block.call, ''] end %{"{\#{#{subst_src}[#{srcs.join(',')}].join(',')}}"} end def array!(arg_name, &block) item_name = block.parameters[0][1].to_s src = block.call(nil) %{"[\#{#{arg_name}.map { |#{item_name}| #{src} }.join(',')}]"} end def integer!(i) %{"#{i}"} end end