module Unicode::Age

Constants

KNOWN_UNICODE_REGEXES
KNOWN_UNICODE_VERSIONS
UNICODE_VERSION
VERSION

Public Class Methods

of(string) click to toggle source
# File lib/unicode/age.rb, line 39
def self.of(string)
  raise(UnknownAge, "The string contains unassigned codepoints, so the Unicode version required cannot be determined. This gem version supports Unicode upto version #{UNICODE_VERSION}.") if string =~ /\A\p{Unassigned}*\z/
  KNOWN_UNICODE_VERSIONS.find.with_index{ |uv, index|
    string =~ KNOWN_UNICODE_REGEXES[index]
  }
end