Module: Lang::Subtags
- Extended by:
- Subtags
- Included in:
- Subtags
- Defined in:
- lib/lang/subtags.rb,
lib/lang/subtags/entry.rb,
lib/lang/subtags/region.rb,
lib/lang/subtags/script.rb,
lib/lang/subtags/extlang.rb,
lib/lang/subtags/variant.rb,
lib/lang/subtags/language.rb,
lib/lang/subtags/redundant.rb,
lib/lang/subtags/grandfathered.rb
Defined Under Namespace
Classes: Entry, Extlang, Grandfathered, Language, Redundant, Region, Script, Variant
Constant Summary
collapse
- LOCK =
Mutex.new
- SEPARATOR =
"%%\n".freeze
- TYPE =
"Type".freeze
- SUBTAG =
"Subtag".freeze
- TAG =
"Tag".freeze
- ADDED =
"Added".freeze
- DEPRECATED =
"Deprecated".freeze
- DESCRIPTION =
"Description".freeze
"Comments".freeze
- PREFIX =
"Prefix".freeze
- PREFERRED_VALUE =
"Preferred-Value".freeze
- MACROLANGUAGE =
"Macrolanguage".freeze
- SCOPE =
"Scope".freeze
- SUPPRESS_SCRIPT =
"Suppress-Script".freeze
- CONTINUE_REGEX =
/\A\s\s/.freeze
- COLON =
":".freeze
- COLON_SPLITTER =
RUBY_VERSION < '1.9.1' ? /\:/.freeze : COLON
- SYM2CLASS =
{}
Instance Method Summary
collapse
Instance Method Details
#close ⇒ Object
57
58
59
60
61
62
|
# File 'lib/lang/subtags.rb', line 57
def close
LOCK.synchronize {
registry.close
indices.close
}
end
|
#entry(kind, snippet) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/lang/subtags.rb', line 45
def entry(kind, snippet)
return nil unless SYM2CLASS.include?(kind)
klass = SYM2CLASS[kind]
LOCK.synchronize {
if klass.entries.key?(snippet) ||
klass.entries.key?(snippet = snippet.downcase)
return klass.entries[snippet]
end
klass.entries[snippet] = load_entry(kind, snippet)
}
end
|
#registry_path ⇒ Object
114
115
116
|
# File 'lib/lang/subtags.rb', line 114
def registry_path
@registry_path ||= File.join(File.dirname(__FILE__), "data", "language-subtag")
end
|