Class: Ruflet::Events::GenericEvent
- Inherits:
-
BasePayload
- Object
- BasePayload
- Ruflet::Events::GenericEvent
- Defined in:
- lib/ruflet_ui/ruflet/events/gesture_events.rb
Direct Known Subclasses
ActionEvent, AutoCompleteSelectEvent, BlurEvent, ChangeEvent, ClickEvent, DismissEvent, DismissibleUpdateEvent, DragTargetEvent, ErrorEvent, FocusEvent, ReorderEvent, ResultEvent, SelectEvent, StateChangeEvent, SubmitEvent, UploadEvent, VisibleEvent
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw:, value: nil) ⇒ GenericEvent
constructor
A new instance of GenericEvent.
Methods inherited from BasePayload
duration, offset, offset_pair, pick, stringify_keys
Constructor Details
#initialize(raw:, value: nil) ⇒ GenericEvent
Returns a new instance of GenericEvent.
42 43 44 45 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 42 def initialize(raw:, value: nil) @raw = raw @value = value end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
40 41 42 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 40 def raw @raw end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
40 41 42 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 40 def value @value end |
Class Method Details
.from_data(data) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 47 def self.from_data(data) raw = data.is_a?(Hash) ? stringify_keys(data) : data value = if raw.is_a?(Hash) raw["value"] || raw["v"] || raw["data"] || raw["state"] || raw["route"] else raw end new(raw: raw, value: value) end |