Module: Ruwi::Utils::Props
- Defined in:
- lib/ruwi/runtime/utils/props.rb
Class Method Summary collapse
-
.extract_props_and_events(vdom) ⇒ Hash
Extract props and events from vdom Equivalent to JavaScript: const { on: events = {}, …props } = vdom.props; delete props.key;.
Class Method Details
.extract_props_and_events(vdom) ⇒ Hash
Extract props and events from vdom Equivalent to JavaScript: const { on: events = {}, …props } = vdom.props; delete props.key;
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ruwi/runtime/utils/props.rb', line 12 def extract_props_and_events(vdom) return { props: {}, events: {} } unless vdom&.props all_props = vdom.props || {} events = all_props[:on] || all_props["on"] || {} # Create props hash excluding the 'on' key and 'key' props = all_props.reject { |key, _| key == :on || key == "on" || key == :key || key == "key" } { props:, events: } end |