Class: Ruflet::Events::DismissibleUpdateEvent
- Inherits:
-
GenericEvent
- Object
- BasePayload
- GenericEvent
- Ruflet::Events::DismissibleUpdateEvent
- Defined in:
- lib/ruflet_ui/ruflet/events/gesture_events.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#progress ⇒ Object
readonly
Returns the value of attribute progress.
-
#reached ⇒ Object
readonly
Returns the value of attribute reached.
Attributes inherited from GenericEvent
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw:, direction:, progress:, reached:) ⇒ DismissibleUpdateEvent
constructor
A new instance of DismissibleUpdateEvent.
Methods inherited from BasePayload
duration, offset, offset_pair, pick, stringify_keys
Constructor Details
#initialize(raw:, direction:, progress:, reached:) ⇒ DismissibleUpdateEvent
Returns a new instance of DismissibleUpdateEvent.
122 123 124 125 126 127 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 122 def initialize(raw:, direction:, progress:, reached:) super(raw: raw, value: progress) @direction = direction @progress = progress @reached = reached end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
120 121 122 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 120 def direction @direction end |
#progress ⇒ Object (readonly)
Returns the value of attribute progress.
120 121 122 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 120 def progress @progress end |
#reached ⇒ Object (readonly)
Returns the value of attribute reached.
120 121 122 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 120 def reached @reached end |
Class Method Details
.from_data(data) ⇒ Object
129 130 131 132 133 134 135 136 137 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 129 def self.from_data(data) raw = data.is_a?(Hash) ? stringify_keys(data) : {} new( raw: raw, direction: raw["direction"] || raw["d"], progress: raw["progress"] || raw["p"] || raw["value"] || raw["v"], reached: raw["reached"] || raw["r"] ) end |