active_interaction 3.5.0 → 3.5.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
  SHA1:
3
- metadata.gz: c2eca96d7ec5eccc82c4321445f7c0e009a0d8e6
4
- data.tar.gz: '048a0f22cd8c0e2071eb1428aff2cd9c88be0482'
3
+ metadata.gz: efaabefa03827c037549d3199559e79028e01014
4
+ data.tar.gz: c31b3dfde06e95dd679771e2719300c3ceeb155a
5
5
  SHA512:
6
- metadata.gz: a67fa88d500066873e6c4626d21fd76c5cf322989fab2fb9ab52f076ce7353d2e22856c4b40b204f23570bfd2d9f218f2c5d2289c77207f43d2a5c21dd557eb7
7
- data.tar.gz: 24daf7828183f8093ea7aa19709a0b49f5f8f9f263cf997dd9c5ed32ae5e45beb7267ad892efff27d5318a67c5c6e75f1f31d9048e734284aabf0da4fbdbb65a
6
+ metadata.gz: e89ce8aa7c3d8ffa79de7720444086a425edc0e287ac0a87d96b5b987bc5275af0c916eef480f59f66b57b0be6c29a0b2c094bb0719de5156d0acb6a7b005bd5
7
+ data.tar.gz: cc04bc1579b22405deba56144038f681bbb99b3db413382bc5126a703a761e711fafbc23fb32dca99271472492619dd58ffec5f1b8628e28c71b8a16ac8f4415
@@ -2,7 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'active_support/core_ext/hash/indifferent_access'
5
- require 'set'
6
5
 
7
6
  module ActiveInteraction
8
7
  # @abstract Subclass and override {#execute} to implement a custom
@@ -277,9 +276,7 @@ module ActiveInteraction
277
276
  @_interaction_inputs = inputs
278
277
 
279
278
  inputs.each do |key, value|
280
- raise InvalidValueError, key.inspect if InputProcessor.reserved?(key)
281
-
282
- populate_reader(key, value)
279
+ populate_reader(key, value) unless InputProcessor.reserved?(key)
283
280
  end
284
281
 
285
282
  populate_filters(InputProcessor.process(inputs))
@@ -48,13 +48,6 @@ module ActiveInteraction
48
48
  # @return [Class]
49
49
  NoDefaultError = Class.new(Error)
50
50
 
51
- # Raised if a reserved name is used.
52
- #
53
- # @return [Class]
54
- #
55
- # @since 1.2.0
56
- ReservedNameError = Class.new(Error)
57
-
58
51
  # Raised if a user-supplied value to a nested hash input is invalid.
59
52
  #
60
53
  # @return [Class]
@@ -14,13 +14,13 @@ module ActiveInteraction
14
14
 
15
15
  def reserved?(name)
16
16
  name.to_s.start_with?('_interaction_') ||
17
- Base.instance_methods.include?(name) ||
18
- Base.private_instance_methods.include?(name)
17
+ Base.method_defined?(name) ||
18
+ Base.private_method_defined?(name)
19
19
  end
20
20
 
21
21
  def process(inputs)
22
22
  inputs.stringify_keys.sort.each_with_object({}) do |(k, v), h|
23
- raise ReservedNameError, k.inspect if reserved?(k)
23
+ next if reserved?(k)
24
24
 
25
25
  if (match = GROUPED_INPUT_PATTERN.match(k))
26
26
  assign_to_group!(h, *match.captures, v)
@@ -6,5 +6,5 @@ module ActiveInteraction
6
6
  # The version number.
7
7
  #
8
8
  # @return [Gem::Version]
9
- VERSION = Gem::Version.new('3.5.0')
9
+ VERSION = Gem::Version.new('3.5.1')
10
10
  end
@@ -35,20 +35,11 @@ describe ActiveInteraction::Base do
35
35
  subject(:interaction) { described_class.new(inputs) }
36
36
 
37
37
  describe '.new(inputs = {})' do
38
- it 'does not allow :_interaction_* as an option' do
39
- key = :"_interaction_#{SecureRandom.hex}"
38
+ it 'does not set instance vars for reserved input names' do
39
+ key = :execute
40
40
  inputs[key] = nil
41
- expect do
42
- interaction
43
- end.to raise_error ActiveInteraction::InvalidValueError
44
- end
45
41
 
46
- it 'does not allow "_interaction_*" as an option' do
47
- key = "_interaction_#{SecureRandom.hex}"
48
- inputs[key] = nil
49
- expect do
50
- interaction
51
- end.to raise_error ActiveInteraction::InvalidValueError
42
+ expect(interaction.instance_variable_defined?(:"@#{key}")).to be false
52
43
  end
53
44
 
54
45
  context 'with invalid inputs' do
@@ -74,10 +74,8 @@ describe ActiveInteraction::InputProcessor do
74
74
  context 'with a reserved name' do
75
75
  before { inputs[:_interaction_key] = :value }
76
76
 
77
- it 'raises an error' do
78
- expect do
79
- result
80
- end.to raise_error ActiveInteraction::ReservedNameError
77
+ it 'skips the input' do
78
+ expect(result).to_not have_key(:_interaction_key)
81
79
  end
82
80
  end
83
81
  end
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: 3.5.0
4
+ version: 3.5.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: 2017-03-19 00:00:00.000000000 Z
12
+ date: 2017-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -273,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
273
  version: '0'
274
274
  requirements: []
275
275
  rubyforge_project:
276
- rubygems_version: 2.6.8
276
+ rubygems_version: 2.6.11
277
277
  signing_key:
278
278
  specification_version: 4
279
279
  summary: Manage application specific business logic.