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 +4 -4
- data/VERSION +1 -1
- data/lib/cldr/export.rb +2 -1
- data/lib/cldr/export/data.rb +1 -0
- data/lib/cldr/export/data/segments_root.rb +51 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af120af07a9dd0cfa1b2a718088d8c2587047ea6
|
4
|
+
data.tar.gz: ec6fecc2e0250efa4a5cebe8dc51dd3c3179eb90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2669e246eb3a7e6a465d55036c99c32bc6d88c77fecf536270cfdc8c5d46c091c0d7c1574e466f6962033a791e92c7e02682905b3f41113065c86e41464156eb
|
7
|
+
data.tar.gz: 328fb66d4fa4e45de8d8268ca0270c40ef008b6aaaedb6dd2764668493cb53204cb7e4bd191a569baac03950ced613fc52895690d43131181f0aa8f1fba61fd2
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/cldr/export.rb
CHANGED
data/lib/cldr/export/data.rb
CHANGED
@@ -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.
|
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
|