normalizy 1.4.0 → 1.5.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
  SHA256:
3
- metadata.gz: 5f14ab0cae60c11869af9ac8bf6fbb51f95d94200f32f72d024dc7374f82e4ed
4
- data.tar.gz: bb91ac9f34acdeeb0e98d8891bd0dc1d8ddade115af057ad5292ee5925455f46
3
+ metadata.gz: 328bb0456c2b8619b62dd267f391e8c5a89091d90d77ae201492f0b3033251ca
4
+ data.tar.gz: 77702f7ae3b66ddc7fc80cd35356d7ce4b16dc364459ba112f7b997771bba23e
5
5
  SHA512:
6
- metadata.gz: dc45e12d2315ef96780d736fcc8554bd78c74f25db2addd6868658c4268196ba64de7c65925798dd8eedc0d31b012a69d542c7725032cb657d4f024900d6adf9
7
- data.tar.gz: e1f89c0c87861c86291d38ef4be32cff60a110ebed57e2b893fbb3a0c29b66e4ba256d5b486d2194b9af26de7442859720d59d690b5930c46aec058206d6437a
6
+ metadata.gz: 0250c84197262d472c2f0f5b951a2deb09bc31a30832269b620bca1c6703e5d32f68db6e5cd85921bd4bd135f3c3bc03224da9db42df6d4d90b601214461d0d3
7
+ data.tar.gz: 92f6b33d5d677fafcc38984488758f99411e9a6386a90fe236b58d90b9c3a6b45c2e7701ac04a9af4c80195c83cfd9eb8bb231f830fc022d079fc1b0b87d9250
@@ -1,6 +1,12 @@
1
+ ## v1.5.0
2
+
3
+ - Features:
4
+ - Filter `date` now supports call object that respond to `beginning_of_day` or `end_of_day`;
5
+
1
6
  ## v1.4.0
2
7
 
3
- - Adds `date` support for `Date` class.
8
+ - Features:
9
+ - Adds `date` support for `Date` class.
4
10
 
5
11
  ## v1.3.0
6
12
 
@@ -13,10 +13,8 @@ module Normalizy
13
13
  end
14
14
  end
15
15
 
16
- if [::Date, DateTime, Time].include?(input.class)
17
- input = input.beginning_of_day if options[:adjust] == :begin
18
- input = input.end_of_day if options[:adjust] == :end
19
- end
16
+ input = input.beginning_of_day if options[:adjust] == :begin && input.respond_to?(:beginning_of_day)
17
+ input = input.end_of_day if options[:adjust] == :end && input.respond_to?(:end_of_day)
20
18
 
21
19
  input
22
20
  rescue ArgumentError
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Normalizy
4
- VERSION = '1.4.0'
4
+ VERSION = '1.5.0'
5
5
  end
@@ -15,6 +15,9 @@ RSpec.describe Normalizy::Filters::Date do
15
15
  it { expect(subject.call(DateTime.new(1984, 1, 1, 1), adjust: :begin)).to eq DateTime.new(1984) }
16
16
  it { expect(subject.call(DateTime.new(1984), adjust: :end)).to eq DateTime.new(1984).end_of_day }
17
17
 
18
+ it { expect(subject.call(OpenStruct.new(beginning_of_day: :success), adjust: :begin)).to eq :success }
19
+ it { expect(subject.call(OpenStruct.new(end_of_day: :success), adjust: :end)).to eq :success }
20
+
18
21
  it do
19
22
  result = subject.call(Date.new(1984, 10, 23), adjust: :end)
20
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: normalizy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Washington Botelho