Module: Sanscript

Defined in:
lib/sanscript/detect.rb,
lib/sanscript.rb,
lib/sanscript/version.rb,
lib/sanscript/benchmark.rb,
lib/sanscript/refinements.rb,
lib/sanscript/transliterate.rb,
lib/sanscript/transliterate/schemes.rb

Overview

Released under the MIT and GPL Licenses.

Defined Under Namespace

Modules: Benchmark, Detect, Refinements, Transliterate

Constant Summary collapse

VERSION =
"0.3.1"

Class Method Summary collapse

Class Method Details

.detect(text) ⇒ Object

Proxies the Detect.detect_script method



12
13
14
# File 'lib/sanscript.rb', line 12

def detect(text)
  Detect.detect_script(text)
end

.transliterate(text, first, second = nil, **options) ⇒ Object

The transliterate method accepts multiple signatures

.transliterate(text, to) will auto-detect the source script
.transliterate(text, to, from) will specify the source and target script

Final Hash arguments are passed along as options.


22
23
24
25
26
27
28
# File 'lib/sanscript.rb', line 22

def transliterate(text, first, second = nil, **options)
  if second.nil?
    second = first
    first = Detect.detect_script(text)
  end
  Transliterate.transliterate(text, first, second, options)
end