active_interaction 4.0.4 → 4.0.5

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: 24af31782cca3b666b2f211506cb3ca39e362ffcb665ae509bda892b13e65934
4
- data.tar.gz: 3a139e271e9d19ac23cdea62a5bbe882889f50483647951289623b8f3aaaf97f
3
+ metadata.gz: cc966bbcee80b29757efdf5bf0b6b0357b8d24610dca49017f4a8cdca64bfaa3
4
+ data.tar.gz: fe255f995b77c90c935fb14ae05660fcc973a3e7ef3e26209d5e1e187624ca21
5
5
  SHA512:
6
- metadata.gz: 574d84a7a67526dcb2b7f64ca885d6cccb3115612e731b4091bd1bb122446a88ce81ad791196c6bd33555122e9b2c8b07ac1924cecbe400f4d541906274fcd3c
7
- data.tar.gz: 1260eae401d19342ef4b8e2ada334553e7b99672b3257ec9b5880d0c6566eb8dc86e8de9fc5c5a3d0ed37485f86fc88cdb3adc2abe6299ac60d049f1d0713474
6
+ metadata.gz: 233b8b4334a5f4d34d12607c054a47aa4839f9c734cd251b682f30173aaa5115e0d8292c0074efd21137a966831b635d2a4e4f3c55f6cb282bb78ed6f795450e
7
+ data.tar.gz: a5fef4055b48c4c72f3f297f52260f0fe4055a2299961d0fd70ebfd7fcfadc2814628a01cec947259e4b99620fc9a2ee313baaa373449aadeba62829eea7be00
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [4.0.5][] (2021-07-11)
2
+
3
+ ## Fix
4
+
5
+ - [#480][] - Interfaces used inside hashes failed to recognize `nil` as a non-value.
6
+
1
7
  # [4.0.4][] (2021-07-03)
2
8
 
3
9
  ## Fix
@@ -183,13 +189,13 @@ has a particular module included, you'll need to use the newly expanded
183
189
 
184
190
  ## Fixed
185
191
 
186
- - [486][] `valid?` returns true if block not called and error added in execute around callback.
192
+ - [#486][] `valid?` returns true if block not called and error added in execute around callback.
187
193
 
188
194
  # [3.8.2][] (2020-04-22)
189
195
 
190
196
  ## Fixed
191
197
 
192
- - [479][] Composed interactions that throw errors now show a complete backtrace instead of ending at the `run!` of the outermost interaction.
198
+ - [#479][] Composed interactions that throw errors now show a complete backtrace instead of ending at the `run!` of the outermost interaction.
193
199
 
194
200
  # [3.8.1][] (2020-04-04)
195
201
 
@@ -958,6 +964,7 @@ Example.run
958
964
 
959
965
  - Initial release.
960
966
 
967
+ [4.0.5]: https://github.com/AaronLasseigne/active_interaction/compare/v4.0.4...v4.0.5
961
968
  [4.0.4]: https://github.com/AaronLasseigne/active_interaction/compare/v4.0.3...v4.0.4
962
969
  [4.0.3]: https://github.com/AaronLasseigne/active_interaction/compare/v4.0.2...v4.0.3
963
970
  [4.0.2]: https://github.com/AaronLasseigne/active_interaction/compare/v4.0.1...v4.0.2
@@ -1172,3 +1179,6 @@ Example.run
1172
1179
  [#499]: https://github.com/AaronLasseigne/active_interaction/issues/499
1173
1180
  [#493]: https://github.com/AaronLasseigne/active_interaction/issues/493
1174
1181
  [#510]: https://github.com/AaronLasseigne/active_interaction/issues/510
1182
+ [#511]: https://github.com/AaronLasseigne/active_interaction/issues/511
1183
+ [#412]: https://github.com/AaronLasseigne/active_interaction/issues/412
1184
+ [#480]: https://github.com/AaronLasseigne/active_interaction/issues/480
@@ -48,6 +48,7 @@ module ActiveInteraction
48
48
  end
49
49
 
50
50
  def matches?(object)
51
+ return false if object.nil?
51
52
  return matches_methods?(object) if options.key?(:methods)
52
53
 
53
54
  const = from
@@ -61,7 +62,7 @@ module ActiveInteraction
61
62
  end
62
63
 
63
64
  def matches_methods?(object)
64
- options.fetch(:methods, []).all? { |method| object.respond_to?(method) }
65
+ options[:methods].all? { |method| object.respond_to?(method) }
65
66
  end
66
67
 
67
68
  def checking_class_inheritance?(object, from)
@@ -73,48 +73,8 @@ module ActiveInteraction
73
73
  end
74
74
  end
75
75
 
76
- def initialize
77
- @groups = {}
78
- @groups.default_proc = ->(hash, key) { hash[key] = [] }
79
-
80
- super(@inputs = {})
81
- end
82
-
83
- # Associates the `value` with the `key`. Allows the `key`/`value` pair to
84
- # be associated with one or more groups.
85
- #
86
- # @example
87
- # inputs.store(:key, :value)
88
- # # => :value
89
- # inputs.store(:key, :value, %i[a b])
90
- # # => :value
91
- #
92
- # @param key [Object] The key to store the value under.
93
- # @param value [Object] The value to store.
94
- # @param groups [Array<Object>] The groups to store the pair under.
95
- #
96
- # @return [Object] value
97
- # @private
98
- def store(key, value, groups = [])
99
- groups.each do |group|
100
- @groups[group] << key
101
- end
102
-
103
- super(key, value)
104
- end
105
-
106
- # Returns inputs from the group name given.
107
- #
108
- # @example
109
- # inputs.group(:a)
110
- # # => {key: :value}
111
- #
112
- # @param name [Object] Name of the group to return.
113
- #
114
- # @return [Hash] Inputs from the group name given.
115
- # @private
116
- def group(name)
117
- @inputs.select { |k, _| @groups[name].include?(k) }
76
+ def initialize(inputs = {})
77
+ super(inputs)
118
78
  end
119
79
  end
120
80
  end
@@ -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.4')
7
+ VERSION = Gem::Version.new('4.0.5')
8
8
  end
@@ -61,6 +61,17 @@ describe ActiveInteraction::InterfaceFilter, :filter do
61
61
  end
62
62
  end
63
63
 
64
+ context 'that is nil' do
65
+ let(:name) { :interface_module }
66
+ let(:value) { nil }
67
+
68
+ it 'raises an error' do
69
+ expect do
70
+ result
71
+ end.to raise_error ActiveInteraction::MissingValueError
72
+ end
73
+ end
74
+
64
75
  context 'with the class itself' do
65
76
  let(:name) { :interface_class }
66
77
  let(:value) do
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.4
4
+ version: 4.0.5
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-07-03 00:00:00.000000000 Z
12
+ date: 2021-07-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel