active_interaction 4.0.0 → 4.0.1

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: acc5f59cdd588429a58556cea7b70aa0c43a6a13c523a682cac266cfc7ab76a1
4
- data.tar.gz: 9a58db1735b436ae91a70baf9c2eab9ef4851a20a9e51c05c6f243af6e3c282b
3
+ metadata.gz: 65047712d1df9c67700202a27f83054c30fccbdf3d7bf7e0478c01e5bea07fc8
4
+ data.tar.gz: b39bb6c7d8784cf842eb266e3955fdbc1082c5a4f96c30bdcbdd10074294ea6d
5
5
  SHA512:
6
- metadata.gz: c78b1f82d8593a238a2076f7351146e51079d163d963cc830d9e086bbc82bd791fbc95527d4fc829e3c38039bb77ce06fefe82520f5b6f2148a64384a8e3a339
7
- data.tar.gz: 362a8b86512c8ef05d9582a377000e06e2b8b0855c112458020911fa77477c3c98cd10555e81d259cfc767f79c1eb8b03e9ec12124cfca38c552208006e1a70a
6
+ metadata.gz: 5ca04e342b3b82a29724e113600ca12bebdc303de3c66c51299fc490cd8686e3a062c77498ccd53e33f02a9dc0e05dc5a44ee26be911af6e59bfcca1b2d41d65
7
+ data.tar.gz: a09744ecbd57a5c69ee845235942c2f2063bfb70f509a9bd6384f45690a35218e6c48c632b2388701f910746614b43b040803329e5310e24ea291267eddd3234
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [4.0.1][] (2021-05-26)
2
+
3
+ ## Fix
4
+
5
+ - Fix regression of filter name relaxing.
6
+ - [#495][] - Fix time filter ignoring time zones
7
+
1
8
  # [4.0.0][] (2021-01-10)
2
9
 
3
10
  ## Changed
@@ -39,9 +39,17 @@ module ActiveInteraction
39
39
  Time.respond_to?(:zone) && !Time.zone.nil?
40
40
  end
41
41
 
42
+ def klass
43
+ if time_with_zone?
44
+ Time.zone
45
+ else
46
+ super
47
+ end
48
+ end
49
+
42
50
  def klasses
43
51
  if time_with_zone?
44
- super + [Time.zone.class]
52
+ [Time.zone.at(0).class, Time]
45
53
  else
46
54
  super
47
55
  end
@@ -18,8 +18,14 @@ module ActiveInteraction
18
18
  def reserved?(name)
19
19
  name.to_s.start_with?('_interaction_') ||
20
20
  name == :syscall ||
21
- Base.method_defined?(name) ||
22
- Base.private_method_defined?(name)
21
+ (
22
+ Base.method_defined?(name) &&
23
+ !Object.method_defined?(name)
24
+ ) ||
25
+ (
26
+ Base.private_method_defined?(name) &&
27
+ !Object.private_method_defined?(name)
28
+ )
23
29
  end
24
30
 
25
31
  def process(inputs)
@@ -4,5 +4,5 @@ module ActiveInteraction
4
4
  # The version number.
5
5
  #
6
6
  # @return [Gem::Version]
7
- VERSION = Gem::Version.new('4.0.0')
7
+ VERSION = Gem::Version.new('4.0.1')
8
8
  end
@@ -25,7 +25,7 @@ describe ActiveInteraction::Hashable do
25
25
  end
26
26
 
27
27
  context 'with a block' do
28
- let(:block) { proc {} } # rubocop:disable Lint/EmptyBlock
28
+ let(:block) { proc {} }
29
29
  let(:hash) { subject.hash(*arguments, &block) }
30
30
 
31
31
  it 'calls method_missing' do
@@ -12,11 +12,11 @@ TimeWithZone = Class.new do
12
12
  end
13
13
 
14
14
  def at(*args)
15
- Time.at(*args)
15
+ TimeWithZone.new(Time.at(*args) + 1)
16
16
  end
17
17
 
18
18
  def parse(*args)
19
- Time.parse(*args)
19
+ TimeWithZone.new(Time.parse(*args) + 1)
20
20
  rescue ArgumentError
21
21
  nil
22
22
  end
@@ -43,7 +43,7 @@ describe TimeInteraction do
43
43
  let(:a) { rand(1 << 16) }
44
44
 
45
45
  it 'returns the correct value' do
46
- expect(result[:a]).to eq Time.zone.at(a)
46
+ expect(result[:a]).to eq TimeWithZone.new(0).at(a)
47
47
  end
48
48
  end
49
49
 
@@ -51,7 +51,7 @@ describe TimeInteraction do
51
51
  let(:a) { '2011-12-13T14:15:16Z' }
52
52
 
53
53
  it 'returns the correct value' do
54
- expect(result[:a]).to eq Time.zone.parse(a)
54
+ expect(result[:a]).to eq TimeWithZone.new(0).parse(a)
55
55
  end
56
56
  end
57
57
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_interaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lasseigne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-10 00:00:00.000000000 Z
12
+ date: 2021-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -247,7 +247,6 @@ files:
247
247
  - lib/active_interaction/locale/it.yml
248
248
  - lib/active_interaction/locale/ja.yml
249
249
  - lib/active_interaction/locale/pt-BR.yml
250
- - lib/active_interaction/modules/input_processor.rb
251
250
  - lib/active_interaction/modules/validation.rb
252
251
  - lib/active_interaction/version.rb
253
252
  - spec/active_interaction/base_spec.rb
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveInteraction
4
- # Groups inputs ending in "(*N*i)" into {GroupedInput}.
5
- #
6
- # @private
7
- module InputProcessor
8
- class << self
9
- GROUPED_INPUT_PATTERN = /\A(.+)\((\d+)i\)\z/.freeze
10
- private_constant :GROUPED_INPUT_PATTERN
11
-
12
- # Checking `syscall` is the result of what appears to be a bug in Ruby.
13
- # https://bugs.ruby-lang.org/issues/15597
14
- def reserved?(name)
15
- name.to_s.start_with?('_interaction_') ||
16
- name == :syscall ||
17
- (
18
- Base.method_defined?(name) &&
19
- !Object.method_defined?(name)
20
- ) ||
21
- (
22
- Base.private_method_defined?(name) &&
23
- !Object.private_method_defined?(name)
24
- )
25
- end
26
-
27
- def process(inputs)
28
- inputs.stringify_keys.sort.each_with_object({}) do |(k, v), h|
29
- next if reserved?(k)
30
-
31
- if (match = GROUPED_INPUT_PATTERN.match(k))
32
- assign_to_group!(h, *match.captures, v)
33
- else
34
- h[k.to_sym] = v
35
- end
36
- end
37
- end
38
-
39
- private
40
-
41
- def assign_to_group!(inputs, key, index, value)
42
- key = key.to_sym
43
-
44
- inputs[key] = GroupedInput.new unless inputs[key].is_a?(GroupedInput)
45
- inputs[key][index] = value
46
- end
47
- end
48
- end
49
- end