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