hoodoo 2.4.1 → 2.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
  SHA256:
3
- metadata.gz: 15b068238ef0e8f90fc5cedd67ce619250ff4ee1babf3025ce2f64808d2cab5f
4
- data.tar.gz: 5528ad58d765ad928bf41879199f2c17a2786f63aa7646152da797cd5aa4f5c4
3
+ metadata.gz: 884e45516b140094f4e6f41c606d82227c841b6b0feb184bf4ada497c41d5f60
4
+ data.tar.gz: 1338b6b24dfd747f06896ffb313dbc376d7ccc6145c15d783c86c57ab9459cff
5
5
  SHA512:
6
- metadata.gz: 7d6a965fdeae003aeede10bd9a0153bf663186e5fa0b7318d5abe9fc288f647e334e44bb00d6092f2ff52062fd460c422f715519a600b09ebb0b2743ec8c21a9
7
- data.tar.gz: 9295602ffeb5a2b40cf660aa7ddb913bcc35b5f4e4cd4e3ceadcd834dc6288ee1faa6cf3c13a072309078517cf6b723a955215f56080ef1f31ac0ae818ffda9e
6
+ metadata.gz: a9ea67e439c7af45e79c345148bc4798823ae63a5686cfd766ab871e6c2bfa9178e8eefa2e73c31c56212306e16061f6cf5747f1a50caf045b64cc43b96fe413
7
+ data.tar.gz: 6aa48383ee9c37109eef2e3d50aeceb4e284422ada533aebb4f6414e7267011e12c93f9dbc8e64f4d94433cf5ed74b9de0c39159e9aa9ef34606c6e3a6005eb7
@@ -410,11 +410,11 @@ module Hoodoo
410
410
  end
411
411
 
412
412
  # Turn a given value of various types into a DateTime instance or +nil+.
413
- # If the input value is not +nil+, a DateTime instance, a Time instance
414
- # or something that <tt>DateTime.parse</tt> can handle, the method will
415
- # throw a RuntimeError exception.
413
+ # If the input value is not +nil+, a DateTime instance, a Time instance,
414
+ # a Date instance or something else that <tt>DateTime.parse</tt> can
415
+ # handle, the method will throw a RuntimeError exception.
416
416
  #
417
- # +input+:: A Time or DateTime instance, or a String that can be
417
+ # +input+:: A Time, Date or DateTime instance, or a String that can be
418
418
  # converted to a DateTime instance; in these cases, an
419
419
  # equivalent DateTime is returned. If +nil+, returns +nil+.
420
420
  #
@@ -422,7 +422,7 @@ module Hoodoo
422
422
  begin
423
423
  if input.nil? || input.is_a?( DateTime )
424
424
  input
425
- elsif input.is_a?( Time )
425
+ elsif input.is_a?( Time ) || input.is_a?( Date )
426
426
  input.to_datetime
427
427
  else
428
428
  DateTime.parse( input )
@@ -12,11 +12,11 @@ module Hoodoo
12
12
  # The Hoodoo gem version. If this changes, be sure to re-run
13
13
  # <tt>bundle install</tt> or <tt>bundle update</tt>.
14
14
  #
15
- VERSION = '2.4.1'
15
+ VERSION = '2.4.2'
16
16
 
17
17
  # The Hoodoo gem date. If this changes, be sure to re-run
18
18
  # <tt>bundle install</tt> or <tt>bundle update</tt>.
19
19
  #
20
- DATE = '2018-04-13'
20
+ DATE = '2018-04-30'
21
21
 
22
22
  end
@@ -608,6 +608,11 @@ describe Hoodoo::Utilities do
608
608
  expect( Hoodoo::Utilities.rationalise_datetime( now ) ).to eq( now.to_datetime )
609
609
  end
610
610
 
611
+ it 'accepts a Date and returns a DateTime' do
612
+ now = Date.today
613
+ expect( Hoodoo::Utilities.rationalise_datetime( now ) ).to eq( now.to_datetime )
614
+ end
615
+
611
616
  # If this fails your system might report time to beyond-nanosecond
612
617
  # precision, so the str-to-DateTime result mismatches the original
613
618
  # DateTime in the fractional seconds.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoodoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loyalty New Zealand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-13 00:00:00.000000000 Z
11
+ date: 2018-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dalli