Class: Ruflet::Events::DismissEvent
- Inherits:
-
GenericEvent
- Object
- BasePayload
- GenericEvent
- Ruflet::Events::DismissEvent
- Defined in:
- lib/ruflet_ui/ruflet/events/gesture_events.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
Attributes inherited from GenericEvent
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw:, value: nil, direction: nil) ⇒ DismissEvent
constructor
A new instance of DismissEvent.
Methods inherited from BasePayload
duration, offset, offset_pair, pick, stringify_keys
Constructor Details
#initialize(raw:, value: nil, direction: nil) ⇒ DismissEvent
Returns a new instance of DismissEvent.
69 70 71 72 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 69 def initialize(raw:, value: nil, direction: nil) super(raw: raw, value: value) @direction = direction end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
67 68 69 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 67 def direction @direction end |
Class Method Details
.from_data(data) ⇒ Object
74 75 76 77 78 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 74 def self.from_data(data) raw = data.is_a?(Hash) ? stringify_keys(data) : {} direction = raw["direction"] || raw["d"] new(raw: raw, value: direction || raw["value"] || raw["v"], direction: direction) end |