Class: JsonSchemaView::Renderers::Json

Inherits:
Base
  • Object
show all
Defined in:
lib/json_schema_view/renderers/json.rb

Overview

Render BaseComponent as json.

Instance Attribute Summary

Attributes inherited from Base

#component

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from JsonSchemaView::Renderers::Base

Instance Method Details

#formatSymbol

Returns the content type of the response. This method is used by ActionView::Template::Renderable.

Returns:

  • (Symbol)


23
24
25
# File 'lib/json_schema_view/renderers/json.rb', line 23

def format
  :json
end

#render_in(view_context) ⇒ String

Render the React component by using react_on_rails. This method is used by ActionView::Template::Renderable.

Parameters:

  • view_content (Object)

Returns:

  • (String)


14
15
16
17
# File 'lib/json_schema_view/renderers/json.rb', line 14

def render_in(view_context)
  view_context.render
  view_context.render(json: component.props.to_json)
end