class KeyboardMap::Event

Attributes

key[R]
modifiers[R]

Public Class Methods

new(key,*modifiers) click to toggle source
# File lib/keyboard_map.rb, line 14
def initialize(key,*modifiers)
  @modifiers = Set[*modifiers.map(&:to_sym)]
  @key = key
end

Public Instance Methods

==(ev) click to toggle source
# File lib/keyboard_map.rb, line 23
def ==(ev)
  case ev
  when Event
    return @modifiers == ev.modifiers && @key == ev.key
  when Symbol
    return self.to_sym == ev
  else
    return self.to_s == ev
  end
end
to_sym() click to toggle source
# File lib/keyboard_map.rb, line 19
def to_sym
  (modifiers.to_a.sort << key).join("_").to_sym
end