class Yj::Render

Public Class Methods

new(context) click to toggle source
# File lib/yj/render.rb, line 3
def initialize(context)
  @context = context
end

Public Instance Methods

call(options) click to toggle source
# File lib/yj/render.rb, line 7
def call(options)
  options[:locals] ||= {}
  options[:locals].merge!(r: self, _partial: true) if options[:collection].present?
  yaml = @context.render options
  YAML.load(yaml).to_json
end