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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b21430641829a22f55906ab8297b87e430152ae9
4
- data.tar.gz: 09ac43ef5066e3357f15a32617a151adfec1e833
3
+ metadata.gz: 9a40d05b869d0449dfa44789ebb566a7982370c4
4
+ data.tar.gz: 250321443eee09d877016c6294f3ee4394764161
5
5
  SHA512:
6
- metadata.gz: 73c5b22e998780e1cd5fc9bf5b2070065df192065533cf975b7afcad3a35b33a8286ce72bd8525be0cff61b0411d8d6046547bd168e23291b794095e7bd35b22
7
- data.tar.gz: 76ea3c044d2b599dda2d588ba285a951b82fc1a531afe0778a0ecf44fc854eb7ff81154880cfbb5b89d0337ca9072a57d5f687ac8beecf61cd4f4177aa4e2fbb
6
+ metadata.gz: 42cebdb43391419a9aa21e5e1c711de3b6a2d77afc5d0353d696dcadb2ddb60ff6f3e2098e02a8ee4e9ab160febd0d62346c6aeb0cb330facf73de0e1482463b
7
+ data.tar.gz: a7df94ba34b1edde8ea787779c9779b35efad66fffebdaf6384f42c63bead587cd13fac6aeba5da0421bc1f9449acf4552bb27a1b58a9b3d400b588286d60d3f
@@ -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.each(&Proc.new)
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 each_date.select { |d| d[:form] == date[:form] }
492
+ delete_children(*each_date.select { |d| d[:form] == date[:form] })
489
493
  add_child date.deep_copy
490
494
  end
491
495
  else
@@ -388,7 +388,7 @@ module CSL
388
388
  def empty?
389
389
  all?(&:nil?)
390
390
  end
391
-
391
+
392
392
  def select(&block)
393
393
  each.select(&block)
394
394
  end
@@ -1,3 +1,3 @@
1
1
  module CSL
2
- VERSION = '1.4.2'.freeze
2
+ VERSION = '1.4.3'.freeze
3
3
  end
@@ -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
@@ -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.2
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-05-16 00:00:00.000000000 Z
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.5
142
+ rubygems_version: 2.4.7
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: A Ruby CSL parser and library