Class: TwitterCldr::Resources::CldrDataBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/resources/cldr_data_builder.rb

Constant Summary collapse

DEEP_MERGER =
proc do |key, v1, v2|
  Hash === v1 && Hash === v2 ? v1.merge(v2, &DEEP_MERGER) : (v2 || v1)
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cldr_locale) ⇒ CldrDataBuilder

Returns a new instance of CldrDataBuilder.



18
19
20
# File 'lib/twitter_cldr/resources/cldr_data_builder.rb', line 18

def initialize(cldr_locale)
  @cldr_locale = cldr_locale
end

Instance Attribute Details

#cldr_localeObject (readonly)

Returns the value of attribute cldr_locale.



16
17
18
# File 'lib/twitter_cldr/resources/cldr_data_builder.rb', line 16

def cldr_locale
  @cldr_locale
end

Instance Method Details

#merge_each_ancestorObject



22
23
24
25
26
# File 'lib/twitter_cldr/resources/cldr_data_builder.rb', line 22

def merge_each_ancestor
  cldr_locale.ancestors.inject({}) do |result, ancestor_locale|
    deep_merge(yield(ancestor_locale), result)
  end
end