date_time_precision 0.5.1 → 0.5.2

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: 6df7946e71f0bd5f715eb269eb11473a223ab8c8
4
- data.tar.gz: 53069451ea0a2048520a739035bb2969a8929279
3
+ metadata.gz: ab8750ef80131b6e004a6a94f09a05edc2841f4c
4
+ data.tar.gz: f0d05d213fc283079b3e605df868995fae7db6a4
5
5
  SHA512:
6
- metadata.gz: dd7cba4355d9e59ec183f2da402c4a643dcb88d01d189a1a1437ef8ef432452161e2ad6c992c3aa369c925956a2ec2fe8dc0ef79769da11e2fba0e742e6d774b
7
- data.tar.gz: 12ba91418764b74d764b65a1e66a42120e5f4ea41e0c230b7960e1ffab2a7dc13c485fa6ecdb0ffacd214b3329556aab65b3f2dd6b4fe06775ded1b821fe89e0
6
+ metadata.gz: a5050a7386517ab4e70dda7c65098f8f06911a64ee2c7e1735aa93e3f794aa03eb75b5b79aea2ba7fe4da00ba652aba974563e3de6852a9ce80e7fb34b9457b1
7
+ data.tar.gz: 64192f5761fcb0037403c7b66268f268de1edf35a11b43bb89b52a97acb5a1a7f443477d269710b10332ebee4b8950f113a471b8fe05af802071f8ef9a329010
@@ -2,8 +2,8 @@ require 'date_time_precision/lib'
2
2
 
3
3
  class Hash
4
4
  DATE_FORMATS = {
5
- :short => [:y, :m, :d],
6
- :long => [:year, :month, :day],
5
+ :short => [:y, :m, :d, :h, :min, :s, :sec_frac],
6
+ :long => [:year, :month, :day, :hour, :minute, :second, :second_fraction],
7
7
  :ruby => [:year, :mon, :day, :hour, :min, :sec, :sec_frac]
8
8
  }
9
9
  DATE_FORMATS[:default] = DATE_FORMATS[:ruby]
@@ -26,9 +26,9 @@ class Hash
26
26
  self[:mon] || self[:m] || self[:month] || self['mon'] || self['m'] || self['month'],
27
27
  self[:mday] || self[:d] || self[:day] || self['mday'] || self['d'] || self['day'],
28
28
  self[:hour] || self[:h] || self[:hr] || self['hour'] || self['h'] || self['hr'],
29
- self[:min] || self['min'],
30
- self[:sec] || self[:s] || self['sec'] || self['s'],
31
- self[:sec_frac] || self['sec_frac']]
29
+ self[:min] || self[:minute] || self['min'] || self["minute"],
30
+ self[:sec] || self[:s] || self[:second] || self['sec'] || self['s'] || self["second"],
31
+ self[:sec_frac] || self[:second_fraction] || self['sec_frac'] || self['second_fraction']]
32
32
  end
33
33
  end
34
34
 
@@ -1,3 +1,3 @@
1
1
  module DateTimePrecision
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
@@ -277,9 +277,31 @@ describe DateTimePrecision do
277
277
  it 'should convert Date to a short hash' do
278
278
  date.to_h(:short).should == short_date_hash
279
279
  end
280
+
281
+ it 'should convert Date to a long hash' do
282
+ date.to_h(:long).should == long_date_hash
283
+ end
280
284
 
281
285
  it 'should convert DateTime to a long hash' do
282
- datetime.to_h(:long).should == long_date_hash
286
+ datetime.to_h(:long).should == {
287
+ :year => 1989,
288
+ :month => 3,
289
+ :day => 11,
290
+ :hour => 8,
291
+ :minute => 30,
292
+ :second => 15
293
+ }
294
+ end
295
+
296
+ it 'should convert Time to a short hash' do
297
+ time.to_h(:short).should == {
298
+ :y => 1989,
299
+ :m => 3,
300
+ :d => 11,
301
+ :h => 8,
302
+ :min => 30,
303
+ :s => 15
304
+ }
283
305
  end
284
306
 
285
307
  it 'should convert Time to a custom hash' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: date_time_precision
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Butler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-01 00:00:00.000000000 Z
11
+ date: 2013-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake