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 +4 -4
- data/lib/performify/base.rb +2 -1
- data/lib/performify/callbacks.rb +2 -0
- data/lib/performify/validation.rb +2 -0
- data/lib/performify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33e27c0ba8a5b203682345fc20496321bdf8f896afe07b6a5560cc8eebabb446
|
4
|
+
data.tar.gz: 984702d047e7381be2672235b2ea35f88c88df605b6bffd590524b398da19ea1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 055f189d9d9c6ef5dd974bc549f5c3254e58626171694ed9f2cfbf50f407c26c643d06d8ddd2fe1b0fe406df1a55be5ff3a657f7b43e66a8db0b1069f9c1c706
|
7
|
+
data.tar.gz: 5ee348d53bc632721f59aba5cc4d50339bb17dce38f858672bd60b2735447d2bcc7ef0def6a76f54719e5558fea5a0c2f9fe022c93b80d16a39a2a871e628955
|
data/lib/performify/base.rb
CHANGED
@@ -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
|
|
data/lib/performify/callbacks.rb
CHANGED
@@ -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
|
data/lib/performify/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|