Class: ReactiveRuby::ServerRendering::ContextualRenderer
- Inherits:
-
React::ServerRendering::BundleRenderer
- Object
- React::ServerRendering::BundleRenderer
- ReactiveRuby::ServerRendering::ContextualRenderer
- Defined in:
- lib/reactive-ruby/server_rendering/contextual_renderer.rb
Instance Method Summary collapse
- #before_render(*args) ⇒ Object
-
#initialize(options = {}) ⇒ ContextualRenderer
constructor
A new instance of ContextualRenderer.
- #render(component_name, props, prerender_options) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ ContextualRenderer
Returns a new instance of ContextualRenderer.
12 13 14 15 |
# File 'lib/reactive-ruby/server_rendering/contextual_renderer.rb', line 12 def initialize( = {}) super() ComponentLoader.new(v8_context).load end |
Instance Method Details
#before_render(*args) ⇒ Object
17 18 19 20 |
# File 'lib/reactive-ruby/server_rendering/contextual_renderer.rb', line 17 def before_render(*args) # the base class clears the log history... we don't want that as it is taken # care of in IsomorphicHelpers.load_context end |
#render(component_name, props, prerender_options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/reactive-ruby/server_rendering/contextual_renderer.rb', line 22 def render(component_name, props, ) if .is_a?(Hash) if !v8_runtime? && [:context_initializer] raise React::ServerRendering::PrerenderError.new(component_name, props, "you must use 'mini_racer' with the prerender[:context] option") unless v8_runtime? else [:context_initializer].call v8_context = [:static] ? :static : true end end super(component_name, props, ) end |