class Sliver::Rails::Processors::JSONProcessor

Public Instance Methods

call() click to toggle source
# File lib/sliver/rails/processors/json_processor.rb, line 2
def call
  response.status                ||= 200
  response.body                    = [body]
  response.headers['Content-Type'] = 'application/json'
end

Private Instance Methods

body() click to toggle source
# File lib/sliver/rails/processors/json_processor.rb, line 10
def body
  return response.body         if response.body.is_a?(String)
  return response.body.to_json if response.body.present?
  return ''                    if template.nil?

  Sliver::Rails::JBuilderRenderer.call template, action.locals
end
template() click to toggle source
# File lib/sliver/rails/processors/json_processor.rb, line 18
def template
  action.class.template
end