Class: CLDR::Object
- Inherits:
-
Object
- Object
- CLDR::Object
- Defined in:
- lib/cldr/object.rb
Constant Summary collapse
- @@data_cache =
{}
Instance Attribute Summary collapse
-
#calendar ⇒ Object
readonly
Returns the value of attribute calendar.
-
#core ⇒ Object
readonly
Returns the value of attribute core.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#supplemental ⇒ Object
readonly
Returns the value of attribute supplemental.
-
#timezone ⇒ Object
readonly
Returns the value of attribute timezone.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Object
constructor
Create a new CLDR::Object object.
Constructor Details
#initialize(opts = {}) ⇒ Object
Create a new CLDR::Object object. This object creates all of the instances of resource classes.
-
opts: options
* :locale: the Locale::Object * :fallback: the alternative Locale::Object when locale is not found.
-
Returns: a newly created Locale::Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cldr/object.rb', line 27 def initialize(opts = {}) locale = opts[:locale] ? opts[:locale] : Locale.get fallback = opts[:fallback] ? opts[:fallback] : Locale::Tag::Cldr.new("en") data = @@data_cache[locale] unless data @core = Core.new(locale, fallback) @calendar = Calendar.new(locale, fallback) @timezone = TimeZone.new(locale, fallback) @number = Number.new(locale, fallback) @currency = Currency.new(locale, fallback) @supplemental = Supplemental.new(locale, fallback) @@data_cache[locale] = [@core, @calendar, @timezone, @number, @currency, @supplemental] else @core, @calendar, @timezone, @number, @currency, @supplemental = data end end |
Instance Attribute Details
#calendar ⇒ Object (readonly)
Returns the value of attribute calendar.
20 21 22 |
# File 'lib/cldr/object.rb', line 20 def calendar @calendar end |
#core ⇒ Object (readonly)
Returns the value of attribute core.
20 21 22 |
# File 'lib/cldr/object.rb', line 20 def core @core end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
20 21 22 |
# File 'lib/cldr/object.rb', line 20 def currency @currency end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
20 21 22 |
# File 'lib/cldr/object.rb', line 20 def number @number end |
#supplemental ⇒ Object (readonly)
Returns the value of attribute supplemental.
20 21 22 |
# File 'lib/cldr/object.rb', line 20 def supplemental @supplemental end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
20 21 22 |
# File 'lib/cldr/object.rb', line 20 def timezone @timezone end |