Class: ReactiveRuby::ServerRendering::ContextualRenderer
- Inherits:
-
React::ServerRendering::SprocketsRenderer
- Object
- React::ServerRendering::SprocketsRenderer
- ReactiveRuby::ServerRendering::ContextualRenderer
- Defined in:
- lib/reactive-ruby/server_rendering/contextual_renderer.rb
Instance Method Summary collapse
-
#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.
13 14 15 16 |
# File 'lib/reactive-ruby/server_rendering/contextual_renderer.rb', line 13 def initialize( = {}) super() ComponentLoader.new(v8_context).load end |
Instance Method Details
#render(component_name, props, prerender_options) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/reactive-ruby/server_rendering/contextual_renderer.rb', line 18 def render(component_name, props, ) if .is_a?(Hash) if v8_runtime? && [:context_initializer] raise PrerenderError.new(component_name, props, "you must use 'therubyracer' with the prerender[:context] option") unless v8_runtime? else [:context_initializer].call v8_context = [:static] ? :static : true end end super(component_name, props, ) end |