Class: Mac::KeyCode

Inherits:
Object
  • Object
show all
Defined in:
lib/mac/key_code.rb,
lib/mac/key_code/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Constructor Details

#initialize(key_code) ⇒ KeyCode

Returns a new instance of KeyCode.



6
7
8
9
# File 'lib/mac/key_code.rb', line 6

def initialize(key_code)
  @key_code = key_code
  @char = KeyCodeNative.key_code_to_char(@key_code)
end

Instance Method Details

#printable?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/mac/key_code.rb', line 11

def printable?
  @char =~ /^[[:print:]\s]+/
end

#to_sObject



15
16
17
# File 'lib/mac/key_code.rb', line 15

def to_s
  @char
end