Class: React::Rails::ControllerRenderer

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, ViewHelper
Defined in:
lib/react/rails/controller_renderer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ViewHelper

#react_component

Constructor Details

#initialize(options = {}) ⇒ ControllerRenderer

Returns a new instance of ControllerRenderer.



8
9
10
11
# File 'lib/react/rails/controller_renderer.rb', line 8

def initialize(options={})
  controller = options[:controller]
  @__react_component_helper = controller.__react_component_helper
end

Instance Attribute Details

#output_bufferObject

Returns the value of attribute output_buffer.



6
7
8
# File 'lib/react/rails/controller_renderer.rb', line 6

def output_buffer
  @output_buffer
end

Instance Method Details

#call(name, options, &block) ⇒ Object



13
14
15
16
17
# File 'lib/react/rails/controller_renderer.rb', line 13

def call(name, options, &block)
  props = options.fetch(:props, {})
  options = options.slice(:data, :tag).merge(prerender: true)
  react_component(name, props, options, &block)
end