Class: Cldr::Data::Base
Direct Known Subclasses
Calendars, Calendars::Gregorian, Currencies, Delimiters, Languages, Numbers, Territories, Timezones, Units
Instance Attribute Summary collapse
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
Instance Method Summary collapse
- #[]=(keys, value) ⇒ Object
-
#initialize(*args) ⇒ Base
constructor
A new instance of Base.
- #update(hash) ⇒ Object
Methods inherited from Hash
#deep_merge, #deep_stringify_keys, #symbolize_keys
Constructor Details
Instance Attribute Details
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
8 9 10 |
# File 'lib/cldr/data/base.rb', line 8 def locale @locale end |
Instance Method Details
#[]=(keys, value) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/cldr/data/base.rb', line 15 def []=(keys, value) return if value.nil? || value.respond_to?(:empty?) && value.empty? keys = keys.to_s.split('.') last_key = keys.pop.to_sym target = keys.inject(self) { |target, key| target[key.to_sym] || target.store(key.to_sym, {}) } target.store(last_key, value) end |
#update(hash) ⇒ Object
25 26 27 |
# File 'lib/cldr/data/base.rb', line 25 def update(hash) hash.each { |key, value| self[key] = value } end |