Method: LocoMotion::ComponentConfig#build

Defined in:
lib/loco_motion/component_config.rb

#buildObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/loco_motion/component_config.rb', line 16

def build
  # Allow users to pass css/html for a specific part (i.e. modal_dialog)
  @component.component_parts.each do |part, defaults|
    @parts[part] = {
      default_css: [],
      default_html: {},
      default_tag_name: defaults[:tag_name] || :div,
      default_stimulus_controllers: [],

      user_css: @options["#{part}_css".to_sym] || [],
      user_html: @options["#{part}_html".to_sym] || {},
      user_tag_name: @options["#{part}_tag_name".to_sym],
      user_stimulus_controllers: @options["#{part}_controllers".to_sym] || [],
    }
  end

  # Allow useres to pass some shortened attributes for the component part
  merge_user_options!(**@options)
end