Class: RailsReactComponents::Components::Prop
- Inherits:
-
Object
- Object
- RailsReactComponents::Components::Prop
- Defined in:
- lib/rails_react_components/components/prop.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #build(component) ⇒ Object
- #include_blank? ⇒ Boolean
-
#initialize(name, options) ⇒ Prop
constructor
A new instance of Prop.
Constructor Details
#initialize(name, options) ⇒ Prop
Returns a new instance of Prop.
6 7 8 9 |
# File 'lib/rails_react_components/components/prop.rb', line 6 def initialize(name, ) @name = name.to_sym = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/rails_react_components/components/prop.rb', line 4 def name @name end |
Instance Method Details
#build(component) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/rails_react_components/components/prop.rb', line 11 def build(component) if on.present? component.send(on).send(name) else component.send(name) end end |
#include_blank? ⇒ Boolean
19 20 21 |
# File 'lib/rails_react_components/components/prop.rb', line 19 def include_blank? .fetch(:include_blank, true) end |