twitter_cldr 4.4.1 → 4.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a2cc94453f8c78e48d4303c07f59ce8a95d71cc
|
4
|
+
data.tar.gz: f634a139429741d33ba009d334d4e6c5399f14e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50385b053655d25df528fb2005c8a9a347b12e6df95008b705027895bff0936186743272992217ce3b6dc76605747b08d93a701f86ef6714559e1bcf4555f1f4
|
7
|
+
data.tar.gz: 1bf6b3213b3815754115f08a322b4182e58a16c4a5b488b172b2292910dfc611de0d79b83d9af16479369b2af768a779f1ccf277a1626f4fde9e8d70b2a8ed77
|
@@ -15,8 +15,8 @@ module TwitterCldr
|
|
15
15
|
|
16
16
|
def format(list, type = :default)
|
17
17
|
if res = resource_for_type(type)
|
18
|
-
if res.include?(list.size)
|
19
|
-
compose(res[list.size], list)
|
18
|
+
if res.include?(:"#{list.size}")
|
19
|
+
compose(res[:"#{list.size}"], list)
|
20
20
|
else
|
21
21
|
compose_list(list, res)
|
22
22
|
end
|
@@ -71,4 +71,4 @@ module TwitterCldr
|
|
71
71
|
|
72
72
|
end
|
73
73
|
end
|
74
|
-
end
|
74
|
+
end
|
data/lib/twitter_cldr/version.rb
CHANGED
@@ -19,29 +19,51 @@ describe ListFormatter do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "#format" do
|
22
|
-
|
22
|
+
context 'with two elements' do
|
23
|
+
let(:list) { ["larry", "curly"] }
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
context 'with an English list formatter' do
|
26
|
+
let(:formatter) { ListFormatter.new(:en) }
|
27
|
+
|
28
|
+
it 'formats English lists correctly using various types' do
|
29
|
+
expect(formatter.format(list)).to eq("larry and curly")
|
30
|
+
expect(formatter.format(list, :unit)).to eq("larry, curly")
|
31
|
+
expect(formatter.format(list, :"unit-narrow")).to eq("larry curly")
|
32
|
+
end
|
27
33
|
end
|
28
34
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
35
|
+
context 'with a Spanish list formatter' do
|
36
|
+
let(:formatter) { ListFormatter.new(:es) }
|
37
|
+
|
38
|
+
it 'formats correctly' do
|
39
|
+
expect(formatter.format(list)).to eq("larry y curly")
|
40
|
+
expect(formatter.format(list, :unit)).to eq("larry y curly")
|
41
|
+
expect(formatter.format(list, :"unit-narrow")).to eq("larry curly")
|
42
|
+
end
|
33
43
|
end
|
34
44
|
end
|
35
45
|
|
36
|
-
context
|
37
|
-
|
38
|
-
|
46
|
+
context 'with three elements' do
|
47
|
+
let(:list) { ["larry", "curly", "moe"] }
|
48
|
+
|
49
|
+
context "with an English list formatter" do
|
50
|
+
let(:formatter) { ListFormatter.new(:en) }
|
51
|
+
|
52
|
+
it "formats English lists correctly using various types" do
|
53
|
+
expect(formatter.format(list)).to eq("larry, curly, and moe")
|
54
|
+
expect(formatter.format(list, :unit)).to eq("larry, curly, moe")
|
55
|
+
expect(formatter.format(list, :"unit-narrow")).to eq("larry curly moe")
|
56
|
+
end
|
39
57
|
end
|
40
58
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
59
|
+
context "with a Spanish list formatter" do
|
60
|
+
let(:formatter) { ListFormatter.new(:es) }
|
61
|
+
|
62
|
+
it "formats Spanish lists correctly using various types" do
|
63
|
+
expect(formatter.format(list)).to eq("larry, curly y moe")
|
64
|
+
expect(formatter.format(list, :unit)).to eq("larry, curly y moe")
|
65
|
+
expect(formatter.format(list, :"unit-narrow")).to eq("larry curly moe")
|
66
|
+
end
|
45
67
|
end
|
46
68
|
end
|
47
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter_cldr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.4.
|
4
|
+
version: 4.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: camertron-eprun
|