Module: RailsReactComponents::Components::Dsl
- Included in:
- RailsReactComponents::Component
- Defined in:
- lib/rails_react_components/components/dsl.rb
Instance Method Summary collapse
- #component(name = nil) ⇒ Object
- #html_option(name, value) ⇒ Object
- #html_options ⇒ Object
- #id(name = nil) ⇒ Object
- #prop(name, options = {}) ⇒ Object
- #props ⇒ Object
Instance Method Details
#component(name = nil) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/rails_react_components/components/dsl.rb', line 14 def component(name = nil) if name.nil? @_component ||= self.name.demodulize else @_component = name end end |
#html_option(name, value) ⇒ Object
34 35 36 |
# File 'lib/rails_react_components/components/dsl.rb', line 34 def html_option(name, value) [name] = value end |
#html_options ⇒ Object
30 31 32 |
# File 'lib/rails_react_components/components/dsl.rb', line 30 def @_html_options ||= {} end |
#id(name = nil) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/rails_react_components/components/dsl.rb', line 22 def id(name = nil) if name.nil? @_id else @_id = name end end |
#prop(name, options = {}) ⇒ Object
10 11 12 |
# File 'lib/rails_react_components/components/dsl.rb', line 10 def prop(name, = {}) props << RailsReactComponents::Components::Prop.new(name, ) end |
#props ⇒ Object
6 7 8 |
# File 'lib/rails_react_components/components/dsl.rb', line 6 def props @_props ||= [] end |