Class: Ruflet::UI::PlatformControlContracts::Components::PlatformControl

Inherits:
Control
  • Object
show all
Defined in:
lib/ruflet_ui/ruflet/ui/platform_control_contracts.rb

Constant Summary

Constants inherited from Control

Control::HOST_EXPANDED_TYPES, Control::SCHEMA_METADATA_CACHE

Instance Attribute Summary

Attributes inherited from Control

#children, #id, #props, #runtime_page, #type, #wire_id

Instance Method Summary collapse

Methods inherited from Control

#attach_handler, #emit, generate_id, #has_handler?, #merge_props, #on, #to_patch

Constructor Details

#initialize(id: nil, **props) ⇒ PlatformControl

Returns a new instance of PlatformControl.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ruflet_ui/ruflet/ui/platform_control_contracts.rb', line 14

def initialize(id: nil, **props)
  props = platform_defaults.merge(props)
  validate_platform_props!(props)
  compact = {}
  props.each do |key, value|
    raise ArgumentError, "unknown keyword: :#{key}" unless self.class::KEYWORDS.include?(key)

    value = normalize_platform_prop(key, value)
    compact[key] = value unless value.nil?
  end
  super(type: self.class::TYPE, id: id, **compact)
end