Class: ReactiveRuby::Rails::ComponentMount
- Inherits:
-
React::Rails::ComponentMount
- Object
- React::Rails::ComponentMount
- ReactiveRuby::Rails::ComponentMount
- Defined in:
- lib/reactive-ruby/rails/component_mount.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
Instance Method Summary collapse
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
4 5 6 |
# File 'lib/reactive-ruby/rails/component_mount.rb', line 4 def controller @controller end |
Instance Method Details
#react_component(name, props = {}, options = {}, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/reactive-ruby/rails/component_mount.rb', line 10 def react_component(name, props = {}, = {}, &block) if [:prerender] || [:on, 'on', true].include?(Hyperloop.prerendering) = (, name) end props = serialized_props(props, name, controller) result = super(top_level_name, props, , &block).gsub("\n","") result = result.gsub(/(<script.*<\/script>)<\/div>$/,'</div>\1').html_safe result + end |
#setup(controller) ⇒ Object
6 7 8 |
# File 'lib/reactive-ruby/rails/component_mount.rb', line 6 def setup(controller) self.controller = controller end |