Module: RailsReactComponents::Components::Dsl

Included in:
RailsReactComponents::Component
Defined in:
lib/rails_react_components/components/dsl.rb

Instance Method Summary collapse

Instance Method Details

#component(name = nil) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rails_react_components/components/dsl.rb', line 12

def component(name = nil)
  if name.nil?
    @_component ||= self.name.demodulize
  else
    @_component = name
  end
end

#html_option(name, value) ⇒ Object



32
33
34
# File 'lib/rails_react_components/components/dsl.rb', line 32

def html_option(name, value)
  html_options[name] = value
end

#html_optionsObject



28
29
30
# File 'lib/rails_react_components/components/dsl.rb', line 28

def html_options
  @_html_options ||= {}
end

#id(name = nil) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/rails_react_components/components/dsl.rb', line 20

def id(name = nil)
  if name.nil?
    @_id
  else
    @_id = name
  end
end

#prop(name, options = {}) ⇒ Object



8
9
10
# File 'lib/rails_react_components/components/dsl.rb', line 8

def prop(name, options = {})
  props << RailsReactComponents::Components::Prop.new(name, options)
end

#propsObject



4
5
6
# File 'lib/rails_react_components/components/dsl.rb', line 4

def props
  @_props ||= []
end