ruby-cldr 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81ab6a59909b72f15381d80ca49053ca46bc54fb
4
- data.tar.gz: 32e6c9fcd5291e54460abaeafc0f12189cc541e6
3
+ metadata.gz: af120af07a9dd0cfa1b2a718088d8c2587047ea6
4
+ data.tar.gz: ec6fecc2e0250efa4a5cebe8dc51dd3c3179eb90
5
5
  SHA512:
6
- metadata.gz: fd2828beca0c9f5828cfcf9b25c5e973d8183ab17b7b93e5dfab4d6b1e92002fa5706d52f8a8ada8b840b18043bdb5bfb4a14379993753b4c536abd411f2139a
7
- data.tar.gz: e51615436d0dfb6718627014defbdeff88093345aa00467e325cad301ac6a5b9c868a85ad8d4c72eacf872f898a4dacfae7e71e81fbf0f2608c47d10e82b3af7
6
+ metadata.gz: 2669e246eb3a7e6a465d55036c99c32bc6d88c77fecf536270cfdc8c5d46c091c0d7c1574e466f6962033a791e92c7e02682905b3f41113065c86e41464156eb
7
+ data.tar.gz: 328fb66d4fa4e45de8d8268ca0270c40ef008b6aaaedb6dd2764668493cb53204cb7e4bd191a569baac03950ced613fc52895690d43131181f0aa8f1fba61fd2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/lib/cldr/export.rb CHANGED
@@ -17,7 +17,8 @@ module Cldr
17
17
  'RbnfRoot',
18
18
  'Metazones',
19
19
  'WindowsZones',
20
- 'NumberingSystems'
20
+ 'NumberingSystems',
21
+ 'SegmentsRoot'
21
22
  ]
22
23
 
23
24
  class << self
@@ -21,6 +21,7 @@ module Cldr
21
21
  autoload :Rbnf, 'cldr/export/data/rbnf'
22
22
  autoload :RbnfRoot, 'cldr/export/data/rbnf_root'
23
23
  autoload :NumberingSystems, 'cldr/export/data/numbering_systems'
24
+ autoload :SegmentsRoot, 'cldr/export/data/segments_root'
24
25
 
25
26
  class << self
26
27
  def dir
@@ -0,0 +1,51 @@
1
+ module Cldr
2
+ module Export
3
+ module Data
4
+ class SegmentsRoot < Base
5
+
6
+ def initialize
7
+ super(nil)
8
+ update(:segments => segmentations)
9
+ end
10
+
11
+ def segmentations
12
+ doc.xpath("ldml/segmentations/segmentation").inject({}) do |ret, seg|
13
+ type = seg.attribute("type").value
14
+ ret[type] = segmentation(seg)
15
+ ret
16
+ end
17
+ end
18
+
19
+ def segmentation(node)
20
+ {
21
+ :variables => variables(node),
22
+ :rules => rules(node)
23
+ }
24
+ end
25
+
26
+ def variables(node)
27
+ (node / "variables" / "variable").map do |variable|
28
+ {
29
+ :id => variable.attribute("id").value,
30
+ :value => variable.text
31
+ }
32
+ end
33
+ end
34
+
35
+ def rules(node)
36
+ (node / "segmentRules" / "rule").map do |rule|
37
+ {
38
+ :id => rule.attribute("id").value,
39
+ :value => rule.text
40
+ }
41
+ end
42
+ end
43
+
44
+ def path
45
+ @path ||= "#{Cldr::Export::Data.dir}/segments/root.xml"
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-cldr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
@@ -164,6 +164,7 @@ files:
164
164
  - lib/cldr/export/data/plurals/rules.rb
165
165
  - lib/cldr/export/data/rbnf.rb
166
166
  - lib/cldr/export/data/rbnf_root.rb
167
+ - lib/cldr/export/data/segments_root.rb
167
168
  - lib/cldr/export/data/territories.rb
168
169
  - lib/cldr/export/data/timezones.rb
169
170
  - lib/cldr/export/data/units.rb