Module: Languager::String
- Includes:
- Subs
- Defined in:
- lib/languager/string.rb
Constant Summary
Constant Summary
Constants included from Subs
Instance Method Summary (collapse)
-
- (String) to_language(name)
(also: #to_lang)
Translates string to specified language by keyboard layout rules (like Punto Switcher), returning nil if no translations were made.
-
- (String) to_language!(name = :ru)
(also: #to_lang!)
Changing the contents of string to specified language by keyboard layout rules (like Punto Switcher), returning nil if no changes were made.
-
- (Object) to_ru
Translates string to russian language by keyboard layout rules (like Punto Switcher), returning nil if no translations were made.
-
- (Object) to_ru!
Changing the contents of string to russian language by keyboard layout rules (like Punto Switcher), returning nil if no changes were made.
Instance Method Details
- (String) to_language(name) Also known as: to_lang
Translates string to specified language by keyboard layout rules (like Punto Switcher), returning nil if no translations were made.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/languager/string.rb', line 17 def to_language(name) result = "" source = SUBS[name] return nil if source.nil? self.each_char do |c| sub = source[c] return nil if sub.nil? result << sub end result end |
- (String) to_language!(name = :ru) Also known as: to_lang!
Changing the contents of string to specified language by keyboard layout rules (like Punto Switcher), returning nil if no changes were made.
37 38 39 40 |
# File 'lib/languager/string.rb', line 37 def to_language!(name = :ru) result = to_language name result.nil? ? nil : replace(result) end |
- (Object) to_ru
Translates string to russian language by keyboard layout rules (like Punto Switcher), returning nil if no translations were made.
5 6 7 |
# File 'lib/languager/string.rb', line 5 def to_ru to_language :ru end |
- (Object) to_ru!
Changing the contents of string to russian language by keyboard layout rules (like Punto Switcher), returning nil if no changes were made.
10 11 12 |
# File 'lib/languager/string.rb', line 10 def to_ru! to_language! :ru end |