Class: RailsReactComponents::Components::Prop
- Inherits:
-
Object
- Object
- RailsReactComponents::Components::Prop
- Defined in:
- lib/rails_react_components/components/prop.rb
Instance Method Summary collapse
- #build(component) ⇒ Object
- #include_blank? ⇒ Boolean
-
#initialize(method_name, options) ⇒ Prop
constructor
A new instance of Prop.
- #name ⇒ Object
Constructor Details
#initialize(method_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(method_name, ) @method_name = method_name.to_sym @options = 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(method_name) else component.send(method_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 |
#name ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/rails_react_components/components/prop.rb', line 23 def name if as.present? as elsif RailsReactComponents.camelize_props method_name.to_s.camelize(:lower).to_sym else method_name end end |