Class: Frails::Component::ReactComponent

Inherits:
AbstractComponent show all
Defined in:
lib/frails/component/react_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractComponent

after_render, before_render, #method_missing

Constructor Details

#initialize(view, options) ⇒ ReactComponent

Returns a new instance of ReactComponent.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/frails/component/react_component.rb', line 6

def initialize(view, options)
  @view, @options = view, options

  @class_name = @options.fetch(:class, nil)
  @props = @options.fetch(:props, {})
  @tag = @options.fetch(:tag, :div)
  @prerender = @options.fetch(:prerender, false)
  @content_loader = @options.fetch(:content_loader, false)

  expand_instance_vars
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Frails::Component::AbstractComponent

Instance Attribute Details

#class_nameObject

Returns the value of attribute class_name.



4
5
6
# File 'lib/frails/component/react_component.rb', line 4

def class_name
  @class_name
end

#content_loaderObject

Returns the value of attribute content_loader.



4
5
6
# File 'lib/frails/component/react_component.rb', line 4

def content_loader
  @content_loader
end

#prerenderObject

Returns the value of attribute prerender.



4
5
6
# File 'lib/frails/component/react_component.rb', line 4

def prerender
  @prerender
end

#propsObject

Returns the value of attribute props.



4
5
6
# File 'lib/frails/component/react_component.rb', line 4

def props
  @props
end

#tagObject

Returns the value of attribute tag.



4
5
6
# File 'lib/frails/component/react_component.rb', line 4

def tag
  @tag
end