Class: RAutomation::Adapter::WinFfi::KeystrokeConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/rautomation/adapter/win_ffi/keystroke_converter.rb

Class Method Summary collapse

Class Method Details

.convert(str)



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rautomation/adapter/win_ffi/keystroke_converter.rb', line 6

def convert(str)
  special_characters = ""

  str.split(/([{}])/).inject([]) do |converted_keys, str|
    if str == "}"
      converted_keys << convert_special_characters(special_characters << str)
      special_characters = ""
    elsif str == "{" || !special_characters.empty?
      special_characters << str
    else
      converted_keys += convert_characters(str)
    end
    converted_keys
  end.flatten
end