Class: Ruflet::Events::AutoCompleteSelectEvent
- Inherits:
-
GenericEvent
- Object
- BasePayload
- GenericEvent
- Ruflet::Events::AutoCompleteSelectEvent
- Defined in:
- lib/ruflet_ui/ruflet/events/gesture_events.rb
Instance Attribute Summary collapse
-
#selection ⇒ Object
readonly
Returns the value of attribute selection.
Attributes inherited from GenericEvent
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw:, value: nil, selection: nil) ⇒ AutoCompleteSelectEvent
constructor
A new instance of AutoCompleteSelectEvent.
Methods inherited from BasePayload
duration, offset, offset_pair, pick, stringify_keys
Constructor Details
#initialize(raw:, value: nil, selection: nil) ⇒ AutoCompleteSelectEvent
Returns a new instance of AutoCompleteSelectEvent.
88 89 90 91 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 88 def initialize(raw:, value: nil, selection: nil) super(raw: raw, value: value) @selection = selection end |
Instance Attribute Details
#selection ⇒ Object (readonly)
Returns the value of attribute selection.
86 87 88 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 86 def selection @selection end |
Class Method Details
.from_data(data) ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 93 def self.from_data(data) raw = data.is_a?(Hash) ? stringify_keys(data) : {} selection = raw["selection"] selection = stringify_keys(selection) if selection.is_a?(Hash) value = raw["value"] || raw["v"] || (selection.is_a?(Hash) ? selection["value"] : nil) new(raw: raw, value: value, selection: selection) end |