Class: Cldr::Export::Data::NumberingSystems

Inherits:
Base
  • Object
show all
Defined in:
lib/cldr/export/data/numbering_systems.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(*args) ⇒ NumberingSystems

Returns a new instance of NumberingSystems.



8
9
10
11
# File 'lib/cldr/export/data/numbering_systems.rb', line 8

def initialize(*args)
  super(nil)
  update(:numbering_systems => numbering_systems)
end

Instance Method Details

#numbering_systemsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cldr/export/data/numbering_systems.rb', line 13

def numbering_systems
  doc.xpath("supplementalData/numberingSystems/numberingSystem").inject({}) do |ret, numbering|
    system_name = numbering.attribute("id").value
    type = numbering.attribute("type").value

    param = case type
      when "numeric"
        "digits"
      when "algorithmic"
        "rules"
    end

    ret[system_name] = {
      :type => type,
      param => numbering.attribute(param).value
    }

    ret
  end
end

#pathObject



34
35
36
# File 'lib/cldr/export/data/numbering_systems.rb', line 34

def path
  @path ||= "#{Cldr::Export::Data.dir}/supplemental/numberingSystems.xml"
end