class Jv::Render
Public Class Methods
new(context)
click to toggle source
# File lib/jv/render.rb, line 3 def initialize(context) @context = context end
Public Instance Methods
call(options)
click to toggle source
# File lib/jv/render.rb, line 7 def call(options) render_collection = options[:collection].present? options[:locals] ||= {} options[:locals].merge!(r: self, _partial: true) if render_collection json = @context.render options if render_collection json.prepend('[') json[-1] = ']' end JSON.load(json) end