performify 0.9.0 → 0.9.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: 4e6799fce4d3edf03f5a9968b9edda80e52dd4d7fae95b5b9ccfdf723d224aa6
4
- data.tar.gz: 25cc0da36e5d829de8fcbc5219e0f8524ed7b5deff9a65bde0277f3b86527955
3
+ metadata.gz: 33e27c0ba8a5b203682345fc20496321bdf8f896afe07b6a5560cc8eebabb446
4
+ data.tar.gz: 984702d047e7381be2672235b2ea35f88c88df605b6bffd590524b398da19ea1
5
5
  SHA512:
6
- metadata.gz: 594ba035cff8f99a47a3fac04df27cc9c512ee949e89504b5b085e3cefe03fb0e0adfeca15a8d9e0ec1f71bd3db8dd3a1abf6018fae98a93abd648a3ef34af96
7
- data.tar.gz: 806d598764d3ba08c8b7200dc925493cc6c5ea5ddefb2d47036a87587b7b770b68fe645d8de858b679f7bcba1a4a9c2b5a348dece82bcff1996a7348bb4af642
6
+ metadata.gz: 055f189d9d9c6ef5dd974bc549f5c3254e58626171694ed9f2cfbf50f407c26c643d06d8ddd2fe1b0fe406df1a55be5ff3a657f7b43e66a8db0b1069f9c1c706
7
+ data.tar.gz: 5ee348d53bc632721f59aba5cc4d50339bb17dce38f858672bd60b2735447d2bcc7ef0def6a76f54719e5558fea5a0c2f9fe022c93b80d16a39a2a871e628955
@@ -32,7 +32,7 @@ module Performify
32
32
  fail!(with_callbacks: false)
33
33
  end
34
34
  rescue RuntimeError, ActiveRecord::RecordInvalid => e
35
- fail!(exception: e)
35
+ fail!(exception: e, with_callbacks: false)
36
36
  end
37
37
 
38
38
  raise ActiveRecord::Rollback if fail?
@@ -75,6 +75,7 @@ module Performify
75
75
  private def prepare_instance
76
76
  define_singleton_method(:execute!) do |&block|
77
77
  return if defined?(@result)
78
+
78
79
  super(&block)
79
80
  end
80
81
 
@@ -12,6 +12,7 @@ module Performify
12
12
  unless TYPES_OF_CALLBACK.include?(type_of_callback)
13
13
  raise UnknownTypeOfCallbackError, "Type #{type_of_callback} is not allowed"
14
14
  end
15
+
15
16
  @service_callbacks ||= {}
16
17
  @service_callbacks[type_of_callback] ||= []
17
18
  @service_callbacks[type_of_callback] << method_name if method_name
@@ -23,6 +24,7 @@ module Performify
23
24
  unless TYPES_OF_CALLBACK.include?(type_of_callback)
24
25
  raise UnknownTypeOfCallbackError, "Type #{type_of_callback} is not allowed"
25
26
  end
27
+
26
28
  cbs = (@service_callbacks || {}).fetch(type_of_callback, [])
27
29
  cbs.each { |cb| cb.is_a?(Proc) ? instance.instance_eval(&cb) : instance.send(cb) }
28
30
  nil
@@ -26,6 +26,7 @@ module Performify
26
26
 
27
27
  def validate
28
28
  return args if schema.nil?
29
+
29
30
  result = schema.with(with_options).call(args)
30
31
  if result.success?
31
32
  @inputs = result.output
@@ -37,6 +38,7 @@ module Performify
37
38
 
38
39
  def errors!(new_errors)
39
40
  raise ArgumentError, 'Errors should be a hash' if new_errors.nil? || !new_errors.respond_to?(:to_h)
41
+
40
42
  new_errors.to_h.each do |key, value|
41
43
  errors[key] = errors.key?(key) ? [errors[key]].flatten(1) + [value].flatten(1) : value
42
44
  end
@@ -1,3 +1,3 @@
1
1
  module Performify
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.9.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: performify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Tsvetkov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-22 00:00:00.000000000 Z
11
+ date: 2018-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord