Module: ICU4X
- Extended by:
- Dry::Configurable
- Defined in:
- lib/icu4x.rb,
lib/icu4x/version.rb,
lib/icu4x/rake_task.rb,
lib/icu4x/yard_docs.rb,
lib/icu4x/data_gem_task.rb
Overview
ICU4X provides internationalization (i18n) functionality for Ruby applications.
This library wraps ICU4X, a Unicode internationalization library written in Rust, providing locale-aware formatting, parsing, and text processing capabilities.
Defined Under Namespace
Classes: Collator, DataError, DataGemTask, DataGenerator, DataGeneratorError, DataProvider, DateTimeFormat, DisplayNames, Error, FormattedPart, ListFormat, Locale, LocaleError, NumberFormat, PluralRules, RakeTask, RelativeTimeFormat, Segmenter
Constant Summary collapse
- VERSION =
The version of the icu4x gem.
"0.0.0"
Class Method Summary collapse
-
.default_provider ⇒ DataProvider?
Returns the default data provider, lazily loaded from configuration.
-
.reset_default_provider! ⇒ void
Resets the cached default data provider.
Class Method Details
.default_provider ⇒ DataProvider?
Returns the default data provider, lazily loaded from configuration.
The provider is created from ‘config.data_path` or the `ICU4X_DATA_PATH` environment variable. Once created, the provider is cached.
28 29 30 31 32 33 34 35 |
# File 'lib/icu4x.rb', line 28 def self.default_provider @default_provider_mutex.synchronize do @default_provider ||= begin path = config.data_path || ENV["ICU4X_DATA_PATH"]&.then {|p| Pathname(p) } path && DataProvider.from_blob(path) end end end |
.reset_default_provider! ⇒ void
This method returns an undefined value.
Resets the cached default data provider.
After calling this method, the next call to default_provider will create a new provider from the current configuration.
39 40 41 42 43 |
# File 'lib/icu4x.rb', line 39 def self.reset_default_provider! @default_provider_mutex.synchronize do @default_provider = nil end end |