Class: Protos::Component

Inherits:
Phlex::HTML
  • Object
show all
Extended by:
Dry::Core::ClassAttributes
Defined in:
lib/protos/component.rb

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ Component

Adds non-defined options to the html_options hash



30
31
32
33
34
35
36
37
38
# File 'lib/protos/component.rb', line 30

def initialize(*, **kwargs, &)
  defined_keys = self.class.dry_initializer.definitions.keys
  defined, undefined =
    kwargs
      .partition { |key, _| defined_keys.include?(key) }
      .map!(&:to_h)

  super(*, html_options: undefined, **defined, &)
end