interaktor 0.5.0 → 0.6.0.pre

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.
data/lib/interaktor.rb CHANGED
@@ -15,9 +15,7 @@ module Interaktor
15
15
  include Hooks
16
16
  include Callable
17
17
 
18
- interaction_class = Class.new(Interaktor::Interaction) do
19
- end
20
-
18
+ interaction_class = Class.new(Interaktor::Interaction)
21
19
  base.const_set(:Interaction, interaction_class)
22
20
  end
23
21
  end
@@ -31,23 +29,13 @@ module Interaktor
31
29
  @interaction = self.class::Interaction.new(self, args)
32
30
  end
33
31
 
34
- # @param args [Hash{Symbol=>Object}]
32
+ # @param args [Hash]
35
33
  def fail!(args = {})
36
- if (disallowed_key = args.keys.find { |k| !self.class.failure_attributes.include?(k.to_sym) })
37
- raise Interaktor::Error::UnknownAttributeError.new(self, disallowed_key)
38
- end
39
-
40
- self.class.validate_failure_schema(args)
41
34
  @interaction.fail!(args)
42
35
  end
43
36
 
44
37
  # @param args [Hash]
45
38
  def success!(args = {})
46
- if (disallowed_key = args.keys.find { |k| !self.class.success_attributes.include?(k.to_sym) })
47
- raise Interaktor::Error::UnknownAttributeError.new(self, disallowed_key)
48
- end
49
-
50
- self.class.validate_success_schema(args)
51
39
  @interaction.success!(args)
52
40
  end
53
41
 
@@ -87,10 +75,6 @@ module Interaktor
87
75
  call
88
76
  end
89
77
 
90
- if self.class.required_success_attributes.any? && !@interaction.success_args
91
- raise Interaktor::Error::MissingExplicitSuccessError.new(self, self.class.required_success_attributes)
92
- end
93
-
94
78
  @interaction.called!(self)
95
79
  end
96
80
  rescue