Class: KeyboardKeyEvaluator
- Inherits:
-
Object
- Object
- KeyboardKeyEvaluator
- Defined in:
- lib/MonkeyKeyboard/keyboard_key_evaluator.rb
Instance Method Summary collapse
- #get_char(keyboard_key) ⇒ Object
-
#initialize ⇒ KeyboardKeyEvaluator
constructor
A new instance of KeyboardKeyEvaluator.
Constructor Details
#initialize ⇒ KeyboardKeyEvaluator
Returns a new instance of KeyboardKeyEvaluator.
4 5 6 7 |
# File 'lib/MonkeyKeyboard/keyboard_key_evaluator.rb', line 4 def initialize @shift_on = false @caps_on = false end |
Instance Method Details
#get_char(keyboard_key) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/MonkeyKeyboard/keyboard_key_evaluator.rb', line 9 def get_char(keyboard_key) @shift_on = !@shift_on if keyboard_key.keyboard_char.char == :shift @caps_on = !@shift_on if keyboard_key.keyboard_char.char == :caps return if keyboard_key.keyboard_char.char.is_a? Symbol return keyboard_key.keyboard_shift_char.char if @shift_on char = keyboard_key.keyboard_char.char return char.upcase if @caps_on char end |