csl 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/csl/locale.rb +6 -2
- data/lib/csl/treelike.rb +1 -1
- data/lib/csl/version.rb +1 -1
- data/spec/csl/locale/date_spec.rb +18 -18
- data/spec/csl/locale_spec.rb +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a40d05b869d0449dfa44789ebb566a7982370c4
|
4
|
+
data.tar.gz: 250321443eee09d877016c6294f3ee4394764161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42cebdb43391419a9aa21e5e1c711de3b6a2d77afc5d0353d696dcadb2ddb60ff6f3e2098e02a8ee4e9ab160febd0d62346c6aeb0cb330facf73de0e1482463b
|
7
|
+
data.tar.gz: a7df94ba34b1edde8ea787779c9779b35efad66fffebdaf6384f42c63bead587cd13fac6aeba5da0421bc1f9449acf4552bb27a1b58a9b3d400b588286d60d3f
|
data/lib/csl/locale.rb
CHANGED
@@ -347,7 +347,11 @@ module CSL
|
|
347
347
|
# block is given, an enumerator is returned instead.
|
348
348
|
def each_date
|
349
349
|
if block_given?
|
350
|
-
date.
|
350
|
+
if date.is_a? CSL::Node
|
351
|
+
yield date
|
352
|
+
else
|
353
|
+
date.each(&Proc.new)
|
354
|
+
end
|
351
355
|
else
|
352
356
|
enum_for :each_date
|
353
357
|
end
|
@@ -485,7 +489,7 @@ module CSL
|
|
485
489
|
|
486
490
|
if has_dates?
|
487
491
|
other.each_date do |date|
|
488
|
-
delete_children
|
492
|
+
delete_children(*each_date.select { |d| d[:form] == date[:form] })
|
489
493
|
add_child date.deep_copy
|
490
494
|
end
|
491
495
|
else
|
data/lib/csl/treelike.rb
CHANGED
data/lib/csl/version.rb
CHANGED
@@ -3,24 +3,24 @@ require 'spec_helper'
|
|
3
3
|
module CSL
|
4
4
|
|
5
5
|
describe Locale::Date do
|
6
|
-
|
6
|
+
|
7
7
|
let(:date) { Locale::Date.new }
|
8
|
-
|
8
|
+
|
9
9
|
it { is_expected.not_to be_nil }
|
10
|
-
|
10
|
+
|
11
11
|
it { is_expected.to be_text }
|
12
12
|
it { is_expected.not_to be_numeric }
|
13
|
-
|
13
|
+
|
14
14
|
describe '#parts' do
|
15
|
-
|
15
|
+
|
16
16
|
it 'returns nil by default' do
|
17
17
|
expect(date.parts).to be_empty
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
describe '#to_xml' do
|
23
|
-
|
23
|
+
|
24
24
|
it 'returns <date/> by default' do
|
25
25
|
expect(Locale::Date.new.to_xml).to eq('<date/>')
|
26
26
|
end
|
@@ -28,36 +28,36 @@ module CSL
|
|
28
28
|
it 'returns <date form="numeric"/> for an empty numeric date' do
|
29
29
|
expect(Locale::Date.new(:form => 'numeric').to_xml).to eq('<date form="numeric"/>')
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
end
|
35
35
|
|
36
36
|
describe Locale::DatePart do
|
37
37
|
|
38
38
|
it { is_expected.not_to be_nil }
|
39
|
-
|
39
|
+
|
40
40
|
it { is_expected.not_to be_day }
|
41
41
|
it { is_expected.not_to be_month }
|
42
42
|
it { is_expected.not_to be_year }
|
43
|
-
|
43
|
+
|
44
44
|
describe '#to_xml' do
|
45
|
-
|
45
|
+
|
46
46
|
it 'returns <date-part/> by default' do
|
47
47
|
expect(Locale::DatePart.new.to_xml).to eq("<date-part/>")
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
it 'returns <date-part name="year"/> when the name is "year"' do
|
51
51
|
expect(Locale::DatePart.new(:name => 'year').to_xml).to eq('<date-part name="year"/>')
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
it 'returns <date-part name="month" form="numeric" prefix="-"/> for a numeric month with prefix "-"' do
|
55
55
|
expect(Locale::DatePart.new(:name => 'month', :form => 'numeric', :prefix => '-').to_xml).to match(/(\s(name|form|prefix)="[^"]+"){3}/)
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
end
|
61
61
|
|
62
62
|
|
63
|
-
end
|
63
|
+
end
|
data/spec/csl/locale_spec.rb
CHANGED
@@ -154,6 +154,15 @@ module CSL
|
|
154
154
|
locale.merge!(Locale.load('en-US'))
|
155
155
|
expect(locale).to have_dates
|
156
156
|
end
|
157
|
+
|
158
|
+
it 'merges dates of both locales' do
|
159
|
+
locale << Locale::Date.new(:form => 'numeric')
|
160
|
+
|
161
|
+
other = Locale.load('en-US')
|
162
|
+
locale.merge! other
|
163
|
+
|
164
|
+
expect(locale.dates.length).to eq(other.dates.length)
|
165
|
+
end
|
157
166
|
end
|
158
167
|
|
159
168
|
describe 'terms' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: namae
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.4.
|
142
|
+
rubygems_version: 2.4.7
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: A Ruby CSL parser and library
|