Class: ABBYY::Cloud::Models::Locale

Inherits:
String
  • Object
show all
Defined in:
lib/abbyy/cloud/models/locale.rb

Constant Summary collapse

FORMAT =
/\A[A-Za-z0-9]{2,}(-[A-Za-z0-9]+)*\z|\A[i|x](-[A-Za-z0-9]+)+\z/

Class Method Summary collapse

Class Method Details

.new(value) ⇒ Object Also known as: []



7
8
9
10
11
12
13
14
15
# File 'lib/abbyy/cloud/models/locale.rb', line 7

def new(value)
  return unless value
  return super if value[FORMAT]
  raise <<-MESSAGE.gsub(" +\|", "")
    |'#{value}' is not a valid locale. See:
    |  RFC-5656 (https://tools.ietf.org/html/rfc5646) for valid format
    |  Full list of locales at http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
  MESSAGE
end