Method: Maglev::BaseComponent#settings_proxy

Defined in:
app/components/maglev/base_component.rb

#settings_proxy(map) ⇒ Object

Useful helper to avoid manipulating hashes eg.: <%= section.settings.body %> instead of <%= section.settings %>



20
21
22
23
24
25
26
# File 'app/components/maglev/base_component.rb', line 20

def settings_proxy(map)
  settings_keys = map.keys
  return nil if settings_keys.blank?

  settings_struct = Struct.new(*settings_keys)
  settings_struct.new(*map.values)
end