Class: Cldr::Export::Data::Lists

Inherits:
Base
  • Object
show all
Defined in:
lib/cldr/export/data/lists.rb

Instance Attribute Summary

Attributes inherited from Base

#locale

Instance Method Summary collapse

Methods inherited from Base

#[]=, #update

Methods inherited from Hash

#deep_merge, #deep_stringify_keys, #symbolize_keys

Constructor Details

#initialize(locale) ⇒ Lists

Returns a new instance of Lists.



5
6
7
8
# File 'lib/cldr/export/data/lists.rb', line 5

def initialize(locale)
  super
  update(:lists => lists)
end

Instance Method Details

#listsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cldr/export/data/lists.rb', line 10

def lists
  select('listPatterns/listPattern').inject({}) do |list_pattern_ret, list_pattern|
    pattern_type = if attribute = list_pattern.attribute('type')
      attribute.value.to_sym
    else
      :default
    end

    list_pattern_ret[pattern_type] = select(list_pattern, 'listPatternPart').inject({}) do |part_ret, part|
      part_ret[part.attribute('type').value.to_sym] = part.content
      part_ret
    end
    list_pattern_ret
  end
end