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.
2 3 4 5 |
# File 'lib/MonkeyKeyboard/keyboard_key_evaluator.rb', line 2 def initialize @shift_on = false @caps_on = false end |
Instance Method Details
#get_char(keyboard_key) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/MonkeyKeyboard/keyboard_key_evaluator.rb', line 7 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 nil if keyboard_key.keyboard_char.char.is_a? Symbol if @shift_on return keyboard_key.keyboard_shift_char.char end char = keyboard_key.keyboard_char.char if @caps_on return char.upcase end char end |