Class: ReactiveRuby::Rails::ComponentMount

Inherits:
React::Rails::ComponentMount
  • Object
show all
Defined in:
lib/reactive-ruby/rails/component_mount.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#controllerObject

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
# File 'lib/reactive-ruby/rails/component_mount.rb', line 10

def react_component(name, props = {}, options = {}, &block)
  options = context_initializer_options(options, name) if options[:prerender]
  props = serialized_props(props, name, controller)
  super(top_level_name, props, options, &block).gsub("\n","")
    .gsub(/(<script>.*<\/script>)<\/div>$/,'</div>\1').html_safe +
    footers
end

#setup(controller) ⇒ Object



6
7
8
# File 'lib/reactive-ruby/rails/component_mount.rb', line 6

def setup(controller)
  self.controller = controller
end