keyboard_convertor 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/keyboard_convertor.rb +5 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1101a39f60420a70fc6e20e9b019d962b5a07531
|
4
|
+
data.tar.gz: 324cc192680830cc57c5608cc75d6742502aa39c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9957a81e60368e04f753b0be16efbe25726b15ced665bdc0783353abed83557293e378466c9873207523b2e327c22c0038f207e6f89ffd6b8f190a5af66af673
|
7
|
+
data.tar.gz: 27e38712972f7173e5273a0edbedea0e9f5f3d7fcdd74ad36c234d009c9c8a84c96d3f0e611305d85b000b36436aa69a2cccdab240eba6766dcfe18c14514191
|
data/lib/keyboard_convertor.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class KeyboardConveror
|
1
|
+
# coding: utf-8
|
2
|
+
class String
|
4
3
|
|
5
4
|
RU_EN = { 'q' => 'й', 'w' => 'ц', 'e' => 'у', 'r' => 'к', 't' => 'е', 'y' => 'н', 'u' => 'г', 'i' => 'ш', 'o' => 'щ', 'p' => 'з', '[' => 'х', ']' => 'ъ', 'a' => 'ф', 's' => 'ы', 'd' => 'в', 'f' => 'а', 'g' => 'п', 'h' => 'р', 'j' => 'о', 'k' => 'л', 'l' => 'д', ';' => 'ж', '\'' => 'э', '\\' => 'ё', 'z' => 'я', 'x' => 'ч', 'c' => 'с', 'v' => 'м', 'b' => 'и', 'n' => 'т', 'm' => 'ь', ',' => 'б', '.' => 'ю', 'Q' => 'Й', 'W' => 'Ц', 'E' => 'У', 'R' => 'К', 'T' => 'Е', 'Y' => 'Н', 'I' => 'Ш', 'O' => 'Щ', 'P' => 'З', '{' => 'Х', '}' => 'Ъ', 'A' => 'Ф', 'S' => 'Ы', 'D' => 'В', 'F' => 'А', 'G' => 'П', 'H' => 'Р', 'J' => 'О', 'K' => 'Л', 'L' => 'Д', ':' => 'Ж', '"' => 'Э', '|' => 'Ё', 'Z' => 'Я', 'X' => 'Ч', 'C' => 'С', 'V' => 'М', 'B' => 'И', 'N' => 'Т', 'M' => 'Ь', '<' => 'Б', '>' => 'Ю'}
|
6
5
|
|
7
|
-
def
|
8
|
-
data =
|
9
|
-
new_word =
|
6
|
+
def convert_keyboard(option)
|
7
|
+
data = String.const_get("#{option[:from]}_#{option[:to]}".upcase)
|
8
|
+
new_word = self.each_char.map do |char|
|
10
9
|
data[char].nil? ? char : data[char]
|
11
10
|
end
|
12
11
|
new_word.join('').force_encoding('UTF-8')
|