Class: Fatty::MouseGesture
- Inherits:
-
Object
- Object
- Fatty::MouseGesture
- Defined in:
- lib/fatty/key_map.rb
Instance Attribute Summary collapse
-
#button ⇒ Object
readonly
Returns the value of attribute button.
-
#ctrl ⇒ Object
readonly
Returns the value of attribute ctrl.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#shift ⇒ Object
readonly
Returns the value of attribute shift.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(button:, ctrl:, meta:, shift:) ⇒ MouseGesture
constructor
A new instance of MouseGesture.
- #inspect ⇒ Object
Constructor Details
#initialize(button:, ctrl:, meta:, shift:) ⇒ MouseGesture
Returns a new instance of MouseGesture.
67 68 69 70 71 72 |
# File 'lib/fatty/key_map.rb', line 67 def initialize(button:, ctrl:, meta:, shift:) @button = @ctrl = ctrl @meta = @shift = shift end |
Instance Attribute Details
#button ⇒ Object (readonly)
Returns the value of attribute button.
65 66 67 |
# File 'lib/fatty/key_map.rb', line 65 def @button end |
#ctrl ⇒ Object (readonly)
Returns the value of attribute ctrl.
65 66 67 |
# File 'lib/fatty/key_map.rb', line 65 def ctrl @ctrl end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
65 66 67 |
# File 'lib/fatty/key_map.rb', line 65 def @meta end |
#shift ⇒ Object (readonly)
Returns the value of attribute shift.
65 66 67 |
# File 'lib/fatty/key_map.rb', line 65 def shift @shift end |
Class Method Details
.from_event(event) ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/fatty/key_map.rb', line 74 def self.from_event(event) new( button: event., ctrl: !!event.ctrl, meta: !!event., shift: !!event.shift, ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
83 84 85 86 87 88 89 |
# File 'lib/fatty/key_map.rb', line 83 def ==(other) other.is_a?(self.class) && == other. && ctrl == other.ctrl && == other. && shift == other.shift end |
#hash ⇒ Object
92 93 94 |
# File 'lib/fatty/key_map.rb', line 92 def hash [self.class, , ctrl, , shift].hash end |
#inspect ⇒ Object
96 97 98 |
# File 'lib/fatty/key_map.rb', line 96 def inspect "#<#{self.class} button=#{.inspect} ctrl=#{ctrl} meta=#{} shift=#{shift}>" end |