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, offset_pair, pick, stringify_keys
Constructor Details
#initialize(raw:, value: nil, state: nil) ⇒ StateChangeEvent
Returns a new instance of StateChangeEvent.
164 165 166 167 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 164 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.
162 163 164 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 162 def state @state end |
Class Method Details
.from_data(data) ⇒ Object
169 170 171 172 173 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 169 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 |