Class: RAutomation::Adapter::MsUia::KeystrokeConverter

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

Class Method Summary collapse

Class Method Details

.convert(str)



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

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