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, BlurEvent, ChangeEvent, ClickEvent, DismissEvent, ErrorEvent, FocusEvent, 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, pick, stringify_keys
Constructor Details
#initialize(raw:, value: nil) ⇒ GenericEvent
Returns a new instance of GenericEvent.
32 33 34 35 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 32 def initialize(raw:, value: nil) @raw = raw @value = value end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
30 31 32 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 30 def raw @raw end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
30 31 32 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 30 def value @value end |
Class Method Details
.from_data(data) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 37 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"] else raw end new(raw: raw, value: value) end |