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



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)
  html_options[name] = value
end

#html_optionsObject



30
31
32
# File 'lib/rails_react_components/components/dsl.rb', line 30

def html_options
  @_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, options = {})
  props << RailsReactComponents::Components::Prop.new(name, options)
end

#propsObject



6
7
8
# File 'lib/rails_react_components/components/dsl.rb', line 6

def props
  @_props ||= []
end