iso8601 0.5.2 → 0.6.0

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: 1e768c6e31ed30d4c5275356329d3eeef4508fd3
4
- data.tar.gz: 3a9ba019e31b7874535e200a067e5e78e583e06c
3
+ metadata.gz: f9dcdc5cbdd5d7ca45c4cdda75be726ba788883b
4
+ data.tar.gz: 579e363f9c3969d20987122e9108e07e94acae56
5
5
  SHA512:
6
- metadata.gz: 18b394d3a4ad6fdd33546d667743aeac309213c40793e66c0f03e0d05da7d0ad6f6f8ae259d7ed4401d2b847e477abc683ec54f1b712487d7d6ade37a28b15b6
7
- data.tar.gz: 4d4f9ef990d4ff79a0023169e96de92200af682835c6124bcf78f98267a31f7eb0b8c2260e1c0909a2cbc4c3b323fa54f1ecae83f23a253fad9e37a3e36c84d5
6
+ metadata.gz: c906351a59be4c6173cb08a666396659b2f37b0ba481899bb751434c5ab316f6fcd2d31f9da188c10307d22d85016851038d26351bb6f35d4f97c94aec77da56
7
+ data.tar.gz: 666289b7461bdd1d29ed51eed7c810fe3a55ec4403df3163cedce303f31f1888877319fce5efc2294122ffb80dd4b5f64a05ffeeb1b9280dc31b384ab868a009
@@ -1,4 +1,8 @@
1
1
 
2
+ ## Changes for 0.6.0
3
+
4
+ * Add `#hash` to `Duration`, `Date`, `Time` and `DateTime`.
5
+
2
6
  ## Changes for 0.5.2
3
7
 
4
8
  * Fix `DateTime` when handling empty strings.
data/README.md CHANGED
@@ -15,6 +15,8 @@ times) standard.
15
15
  * MRI 2.1
16
16
  * RBX 2
17
17
 
18
+ Check the [changelog](https://github.com/arnau/ISO8601/blob/master/CHANGELOG.md) if you are upgrading from an older version.
19
+
18
20
 
19
21
  ## Comments about this implementation
20
22
 
@@ -82,24 +84,6 @@ Week dates raise an error when two digit days provied instead of return monday:
82
84
  DateTime.new('2014-W15-02') # => #<Date: 2014-04-07 ((2456755j,0s,0n),+0s,2299161j)>
83
85
 
84
86
 
85
- ## Changes since 0.5
86
-
87
- * Drop support for Ruby 1.8.7
88
- * Add support for Rubinius 2
89
- * `ISO8601::DateTime#century` no longer exists. Truncated representations were
90
- removed in ISO 8601:2004.
91
- * `ISO8601::DateTime#zone` delegates to core `DateTime#zone`.
92
- * `ISO8601::DateTime#timezone` no longer exists. Now it delegates to
93
- `DateTime#zone`.
94
- * A date can have sign: `-1000-01-01`, `+2014-05-06T10:11:12Z`.
95
- * A date time can be converted to an array of atoms with `#to_a`.
96
- * Ordinal dates supported.
97
- * A date component is represented by `ISO8601::Date`.
98
- * Week date pattern (YYYY-Wdww, YYYY-Www-D).
99
-
100
- Check the [changelog](https://github.com/arnau/ISO8601/blob/master/CHANGELOG.md)
101
- for a more complete list.
102
-
103
87
 
104
88
  ## TODO
105
89
 
@@ -108,11 +92,8 @@ for a more complete list.
108
92
 
109
93
  ## Contributors
110
94
 
111
- * [Nick Lynch](https://github.com/njlynch)
112
- * [Pelle Braendgaard](https://github.com/pelle)
113
- * [Takahiro Noda](https://github.com/tnoda)
114
- * [Porras](https://github.com/porras)
115
- * [Kenichi Kamiya](https://github.com/kachick)
95
+ [Contributors](https://github.com/arnau/ISO8601/graphs/contributors)
96
+
116
97
 
117
98
  ## License
118
99
 
@@ -17,7 +17,7 @@ module ISO8601
17
17
 
18
18
  def_delegators(:@date,
19
19
  :to_s, :to_time, :to_date, :to_datetime,
20
- :year, :month, :day, :wday)
20
+ :year, :month, :day, :wday, :hash)
21
21
  ##
22
22
  # The original atoms
23
23
  attr_reader :atoms
@@ -12,7 +12,7 @@ module ISO8601
12
12
 
13
13
  def_delegators(:@date_time,
14
14
  :strftime, :to_time, :to_date, :to_datetime,
15
- :year, :month, :day, :hour, :minute, :zone)
15
+ :year, :month, :day, :hour, :minute, :zone, :hash)
16
16
 
17
17
  attr_reader :second
18
18
 
@@ -147,6 +147,12 @@ module ISO8601
147
147
  raise ISO8601::Errors::DurationBaseError.new(duration) if @base.to_s != duration.base.to_s
148
148
  (self.to_seconds == duration.to_seconds)
149
149
  end
150
+ ##
151
+ # @return [Fixnum]
152
+ def hash
153
+ @atoms.hash
154
+ end
155
+
150
156
 
151
157
  private
152
158
  ##
@@ -14,7 +14,7 @@ module ISO8601
14
14
 
15
15
  def_delegators(:@time,
16
16
  :to_time, :to_date, :to_datetime,
17
- :hour, :minute, :zone)
17
+ :hour, :minute, :zone, :hash)
18
18
  ##
19
19
  # The separator used in the original ISO 8601 string.
20
20
  attr_reader :separator
@@ -1,5 +1,5 @@
1
1
  module ISO8601
2
2
  ##
3
3
  # The gem version
4
- VERSION = '0.5.2'
4
+ VERSION = '0.6.0'
5
5
  end
@@ -122,4 +122,15 @@ describe ISO8601::DateTime do
122
122
  dt.should == [2014, 5, 31, 19, 29, 39, '+00:00']
123
123
  end
124
124
  end
125
+
126
+ describe '#hash' do
127
+ it "should return the datetime hash" do
128
+ subject = ISO8601::DateTime.new('2014-08-16T20:11:10Z')
129
+ contrast = ::DateTime.new(2014, 8, 16, 20, 11, 10, 'Z')
130
+
131
+ expect(subject).to respond_to(:hash)
132
+ expect(subject.hash).to eq(contrast.hash)
133
+ end
134
+ end
135
+
125
136
  end
@@ -81,4 +81,14 @@ describe ISO8601::Date do
81
81
  ISO8601::Date.new('2014').atoms.should == [2014]
82
82
  end
83
83
  end
84
+
85
+ describe '#hash' do
86
+ it "should return the date hash" do
87
+ subject = ISO8601::Date.new('2014-08-16')
88
+ contrast = ::Date.new(2014, 8, 16)
89
+
90
+ expect(subject).to respond_to(:hash)
91
+ expect(subject.hash).to eq(contrast.hash)
92
+ end
93
+ end
84
94
  end
@@ -217,4 +217,11 @@ describe ISO8601::Duration do
217
217
  end
218
218
  end
219
219
 
220
+ describe '#hash' do
221
+ it "should return the duration hash" do
222
+ subject = ISO8601::Duration.new('PT1H')
223
+
224
+ expect(subject).to respond_to(:hash)
225
+ end
226
+ end
220
227
  end
@@ -80,4 +80,13 @@ describe ISO8601::Time do
80
80
  ISO8601::Time.new('T19').atoms.should == [19]
81
81
  end
82
82
  end
83
+
84
+ describe '#hash' do
85
+ it "should return the time hash" do
86
+ subject = ISO8601::Time.new('T20:11:10Z')
87
+
88
+ expect(subject).to respond_to(:hash)
89
+ end
90
+ end
91
+
83
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iso8601
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnau Siches
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-12 00:00:00.000000000 Z
11
+ date: 2014-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec