Module: DroidAdbs::IME
- Defined in:
- lib/droid_adbs/commons/ime.rb
Class Method Summary collapse
-
.get_ime_list ⇒ Array
Array of IME ID list.
-
.get_ime_with_string ⇒ String
Message from adb command as pure string.
-
.parse_ime_list(ime_lists) ⇒ Array
Array of IME ID list.
-
.set_ime(ime_id) ⇒ String
Message from adb command.
Class Method Details
.get_ime_list ⇒ Array
Returns Array of IME ID list.
15 16 17 18 |
# File 'lib/droid_adbs/commons/ime.rb', line 15 def get_ime_list string = get_ime_with_string parse_ime_list(string) end |
.get_ime_with_string ⇒ String
Returns message from adb command as pure string.
5 6 7 |
# File 'lib/droid_adbs/commons/ime.rb', line 5 def get_ime_with_string `#{::DroidAdbs.shell} ime list`.strip end |
.parse_ime_list(ime_lists) ⇒ Array
Returns Array of IME ID list.
35 36 37 |
# File 'lib/droid_adbs/commons/ime.rb', line 35 def parse_ime_list(ime_lists) ime_lists.each_line.map { |line| line.chomp.scan(/\A\S+:\z/).first }.compact.map(&:chop) end |
.set_ime(ime_id) ⇒ String
Returns message from adb command. If it succeeded to set IME, then it returns “Input method com.google.android.inputmethod.japanese/.MozcService selected” If it failed to set IME because of no ID, then it returns “Error: Unknown id: ime_id”.
24 25 26 |
# File 'lib/droid_adbs/commons/ime.rb', line 24 def set_ime(ime_id) `#{::DroidAdbs.shell} ime set #{ime_id}`.strip end |