Class: Neotrellis::Keypad::KeyEvent
- Inherits:
-
Object
- Object
- Neotrellis::Keypad::KeyEvent
- Defined in:
- lib/neotrellis/keypad.rb
Overview
Represent an event attached to a key
Instance Attribute Summary collapse
-
#edge ⇒ Object
readonly
Event type.
-
#key ⇒ Object
readonly
Key ID.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(key, edge) ⇒ KeyEvent
constructor
Create a new event.
- #to_s ⇒ Object
Constructor Details
#initialize(key, edge) ⇒ KeyEvent
Create a new event.
190 191 192 193 |
# File 'lib/neotrellis/keypad.rb', line 190 def initialize(key, edge) @key = key @edge = edge end |
Instance Attribute Details
#edge ⇒ Object (readonly)
Event type
184 185 186 |
# File 'lib/neotrellis/keypad.rb', line 184 def edge @edge end |
#key ⇒ Object (readonly)
Key ID
183 184 185 |
# File 'lib/neotrellis/keypad.rb', line 183 def key @key end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
199 200 201 |
# File 'lib/neotrellis/keypad.rb', line 199 def ==(other) @key == other.key && @edge == other.edge end |
#hash ⇒ Object
205 206 207 |
# File 'lib/neotrellis/keypad.rb', line 205 def hash @key.hash ^ @edge.hash # XOR end |
#to_s ⇒ Object
195 196 197 |
# File 'lib/neotrellis/keypad.rb', line 195 def to_s "Event-#{key}-#{edge}" end |