Module: Sanscript::Detect

Extended by:
Ruby24, Ruby2x
Defined in:
lib/sanscript/detect.rb,
lib/sanscript/detect/rust.rb,
lib/sanscript/detect/ruby24.rb,
lib/sanscript/detect/ruby2x.rb,
lib/sanscript/detect/constants.rb

Overview

Transliteration scheme detection module. Developed from code available @ github.com/sanskrit/detect.js

Defined Under Namespace

Modules: Ruby24, Ruby2x, Rust

Class Method Summary collapse

Methods included from Ruby24

ruby_detect_scheme

Methods included from Ruby2x

ruby_detect_scheme

Class Method Details

.detect_scheme(text) ⇒ Symbol?

Attempts to detect the encoding scheme of the provided string.

Uses the most efficient implementation for your ruby version (either Sanscript::Detect::Ruby2x#ruby_detect_scheme or Sanscript::Detect::Ruby24#ruby_detect_scheme) at first, which may be then overriden by the Rust native extension (see Sanscript.rust_enable! and Sanscript.rust_disable!)

Parameters:

  • text (String)

    a string of Sanskrit text

Returns:

  • (Symbol, nil)

    the Symbol of the scheme, or nil if no match



31
# File 'lib/sanscript/detect.rb', line 31

singleton_class.send(:alias_method, :detect_scheme, :ruby_detect_scheme)