simple_ruby_service 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/simple_ruby_service/service.rb +7 -5
- data/lib/simple_ruby_service/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: 93055c8359bf7677e53e99e5cae18f128e17f643770b51e207cdfd4892bf1ac2
|
4
|
+
data.tar.gz: 916d16d46e8c43ca5815e40b940df3d768e9d22fec56990fa29fb4c0610235a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d68822b1a43f2a664c9e4b6f48a7b0a81de97686d346147e5b1d9bc6163e69d3df83a199908a82da6f2f694b704821aab54c019e35f35f3bfefed47c71499f42
|
7
|
+
data.tar.gz: cc1b27bbb4d6fd18dfb161d504787a4828a27a0babe4550f0864f1f9f9d740749a0e7983792b8e92d9f030ad7b1afa23be0220ee239939e4cf7cda3b11bb7d96
|
data/CHANGELOG.md
CHANGED
@@ -6,10 +6,13 @@ module SimpleRubyService
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
include ActiveModel::AttributeAssignment
|
8
8
|
include ActiveModel::Validations
|
9
|
-
include ActiveModel::Validations::Callbacks
|
9
|
+
include ActiveModel::Validations::Callbacks
|
10
10
|
|
11
11
|
included do
|
12
12
|
attr_accessor :value
|
13
|
+
|
14
|
+
class_attribute :set_value_when_service_methods_return
|
15
|
+
self.set_value_when_service_methods_return = true
|
13
16
|
end
|
14
17
|
|
15
18
|
class_methods do
|
@@ -33,7 +36,7 @@ module SimpleRubyService
|
|
33
36
|
# Class level DSL that wraps the methods defined in inherited classes.
|
34
37
|
def service_methods(&blk)
|
35
38
|
Module.new.tap do |m| # Using anonymous modules so that super can be used to extend service methods
|
36
|
-
m.module_eval
|
39
|
+
m.module_eval(&blk)
|
37
40
|
include m
|
38
41
|
|
39
42
|
m.instance_methods.each do |service_method|
|
@@ -42,7 +45,8 @@ module SimpleRubyService
|
|
42
45
|
# Returns self (for chainability).
|
43
46
|
# Evaluates validity prior to executing the block provided.
|
44
47
|
define_method service_method do |*args, **kwargs, &callback|
|
45
|
-
perform(service_method, *args, **kwargs, &callback) if valid?
|
48
|
+
result = perform(service_method, *args, **kwargs, &callback) if valid?
|
49
|
+
self.value = result if set_value_when_service_methods_return
|
46
50
|
|
47
51
|
self
|
48
52
|
end
|
@@ -131,5 +135,3 @@ module SimpleRubyService
|
|
131
135
|
end
|
132
136
|
end
|
133
137
|
end
|
134
|
-
|
135
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_ruby_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Crouch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|