Class: Iuliia::Translit
- Inherits:
-
Object
- Object
- Iuliia::Translit
- Defined in:
- lib/iuliia/translit.rb
Instance Method Summary collapse
-
#initialize(string, schema) ⇒ Iuliia::Translit
constructor
Initialize transliterator engine with string and schema.
-
#translit ⇒ String
Translit cyrillic string to latin representation.
Constructor Details
#initialize(string, schema) ⇒ Iuliia::Translit
Initialize transliterator engine with string and schema
12 13 14 15 |
# File 'lib/iuliia/translit.rb', line 12 def initialize(string, schema) @string = string @schema = Iuliia::Schema[schema] end |
Instance Method Details
#translit ⇒ String
Translit cyrillic string to latin representation
19 20 21 22 23 |
# File 'lib/iuliia/translit.rb', line 19 def translit return unless schema string.split(/\b/).map { |chunk| translit_chunk(chunk) }.join end |