Module: Blundersaur::Keyboards::Qwerty

Defined in:
lib/blundersaur/keyboards/qwerty.rb

Constant Summary collapse

ROWS =
[
  nil, "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", nil,
  nil, "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", nil,
  nil, "a", "s", "d", "f", "g", "h", "j", "k", "l", nil,
  nil, "z", "x", "c", "v", "b", "n", "m", nil
]

Class Method Summary collapse

Class Method Details

.keys_near(char) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/blundersaur/keyboards/qwerty.rb', line 10

def self.keys_near(char)
  upcased = char.ord < 97
  i = ROWS.index(char.downcase)
  keys = ROWS.values_at(i-1, i+1).compact
  keys.collect!(&:upcase) if upcased
  keys
end