class Yj::Handler
Public Class Methods
call(template)
click to toggle source
# File lib/yj/handler.rb, line 10 def self.call(template) <<~SRC _partial ||= false r ||= Yj::Render.new(self) yaml = ERB.new(%{#{template.source}}, nil, '-').result(binding) return MultiJson.dump(YAML.load(yaml)) unless _partial yaml.each_line.with_index.map do |line, idx| idx == 0 ? "- \#{line}" : " \#{line}" end.join SRC end