light-services 2.0.0.rc9 → 2.0
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.
- checksums.yaml +4 -4
- data/.github/config/rubocop_linter_action.yml +3 -3
- data/.github/workflows/ci.yml +3 -3
- data/.ruby-version +1 -0
- data/Gemfile +8 -8
- data/Gemfile.lock +85 -58
- data/README.md +28 -29
- data/lib/light/services/base.rb +3 -0
- data/lib/light/services/class_based_collection/base.rb +1 -1
- data/lib/light/services/class_based_collection/mount.rb +5 -5
- data/lib/light/services/config.rb +3 -3
- data/lib/light/services/settings/argument.rb +3 -3
- data/lib/light/services/settings/output.rb +2 -2
- data/lib/light/services/version.rb +1 -1
- data/light-services.gemspec +4 -4
- metadata +10 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e8a693c78f413c2ca03c2381e2bf4ae82355d3546eb8c4a2418181ed6c0a2205
|
|
4
|
+
data.tar.gz: 68dd61477720f1c5ec6f5702b088c3a1a7251e3ee008b963e27924ec1d6142aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 76b9503f757f4135648f02a7ce128bd2a82b3eb4350fd42fb6abf12867e8321d1930d77936983925441e2aed28bef65a976e147853290076b1314ad2a2ebb8bb
|
|
7
|
+
data.tar.gz: 96646aa52768b79fb0255a5a9209444171ccd10b4a42d761888e7e51ca417e254bef4668a216ac389eeec0d7133a42343ae26714cddb8ee6150a341c601d16d1
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
versions:
|
|
2
|
-
- rubocop: "
|
|
3
|
-
- rubocop-rspec: "
|
|
4
|
-
- rubocop-performance: "1.
|
|
2
|
+
- rubocop: "1.63"
|
|
3
|
+
- rubocop-rspec: "2.29"
|
|
4
|
+
- rubocop-performance: "1.21"
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -19,7 +19,7 @@ jobs:
|
|
|
19
19
|
runs-on: ubuntu-latest
|
|
20
20
|
strategy:
|
|
21
21
|
matrix:
|
|
22
|
-
ruby: [
|
|
22
|
+
ruby: [3.0, 3.1, 3.2, head, debug]
|
|
23
23
|
steps:
|
|
24
24
|
- name: Git Checkout
|
|
25
25
|
uses: actions/checkout@v2
|
|
@@ -28,7 +28,7 @@ jobs:
|
|
|
28
28
|
run: sudo apt-get install libsqlite3-dev
|
|
29
29
|
|
|
30
30
|
- name: Setup Ruby
|
|
31
|
-
uses: ruby/setup-ruby@v1
|
|
31
|
+
uses: ruby/setup-ruby@v1
|
|
32
32
|
with:
|
|
33
33
|
ruby-version: ${{ matrix.ruby }}
|
|
34
34
|
bundler-cache: true
|
|
@@ -49,7 +49,7 @@ jobs:
|
|
|
49
49
|
run: sudo apt-get install libsqlite3-dev
|
|
50
50
|
|
|
51
51
|
- name: Setup Ruby
|
|
52
|
-
uses: ruby/setup-ruby@v1
|
|
52
|
+
uses: ruby/setup-ruby@v1
|
|
53
53
|
with:
|
|
54
54
|
ruby-version: head
|
|
55
55
|
bundler-cache: true
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.3.1
|
data/Gemfile
CHANGED
|
@@ -5,16 +5,16 @@ source "https://rubygems.org"
|
|
|
5
5
|
gemspec
|
|
6
6
|
|
|
7
7
|
group :test do
|
|
8
|
-
gem "activerecord", "~>
|
|
9
|
-
gem "database_cleaner-active_record", "~> 1
|
|
10
|
-
gem "sqlite3", "~> 1.
|
|
8
|
+
gem "activerecord", "~> 7.0"
|
|
9
|
+
gem "database_cleaner-active_record", "~> 2.1"
|
|
10
|
+
gem "sqlite3", "~> 1.7"
|
|
11
11
|
|
|
12
12
|
gem "codecov", "~> 0.6.0"
|
|
13
|
-
gem "rake", "~> 13.
|
|
14
|
-
gem "rspec", "~> 3.
|
|
13
|
+
gem "rake", "~> 13.2"
|
|
14
|
+
gem "rspec", "~> 3.13"
|
|
15
15
|
gem "simplecov", "~> 0.21"
|
|
16
16
|
|
|
17
|
-
gem "rubocop", "~> 1.
|
|
18
|
-
gem "rubocop-
|
|
19
|
-
gem "rubocop-
|
|
17
|
+
gem "rubocop", "~> 1.63", require: false
|
|
18
|
+
gem "rubocop-rspec", "~> 2.29", require: false
|
|
19
|
+
gem "rubocop-performance", "~> 1.21", require: false
|
|
20
20
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,99 +1,126 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
light-services (2.0
|
|
4
|
+
light-services (2.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
activemodel (
|
|
10
|
-
activesupport (=
|
|
11
|
-
activerecord (
|
|
12
|
-
activemodel (=
|
|
13
|
-
activesupport (=
|
|
14
|
-
|
|
9
|
+
activemodel (7.1.3.2)
|
|
10
|
+
activesupport (= 7.1.3.2)
|
|
11
|
+
activerecord (7.1.3.2)
|
|
12
|
+
activemodel (= 7.1.3.2)
|
|
13
|
+
activesupport (= 7.1.3.2)
|
|
14
|
+
timeout (>= 0.4.0)
|
|
15
|
+
activesupport (7.1.3.2)
|
|
16
|
+
base64
|
|
17
|
+
bigdecimal
|
|
15
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
19
|
+
connection_pool (>= 2.2.5)
|
|
20
|
+
drb
|
|
16
21
|
i18n (>= 1.6, < 2)
|
|
17
22
|
minitest (>= 5.1)
|
|
23
|
+
mutex_m
|
|
18
24
|
tzinfo (~> 2.0)
|
|
19
|
-
zeitwerk (~> 2.3)
|
|
20
25
|
ast (2.4.2)
|
|
26
|
+
base64 (0.2.0)
|
|
27
|
+
bigdecimal (3.1.7)
|
|
21
28
|
codecov (0.6.0)
|
|
22
29
|
simplecov (>= 0.15, < 0.22)
|
|
23
|
-
concurrent-ruby (1.
|
|
24
|
-
|
|
25
|
-
database_cleaner-active_record (1.
|
|
26
|
-
activerecord
|
|
27
|
-
database_cleaner (~>
|
|
28
|
-
|
|
30
|
+
concurrent-ruby (1.2.3)
|
|
31
|
+
connection_pool (2.4.1)
|
|
32
|
+
database_cleaner-active_record (2.1.0)
|
|
33
|
+
activerecord (>= 5.a)
|
|
34
|
+
database_cleaner-core (~> 2.0.0)
|
|
35
|
+
database_cleaner-core (2.0.1)
|
|
36
|
+
diff-lcs (1.5.1)
|
|
29
37
|
docile (1.4.0)
|
|
30
|
-
|
|
38
|
+
drb (2.2.1)
|
|
39
|
+
i18n (1.14.4)
|
|
31
40
|
concurrent-ruby (~> 1.0)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
json (2.7.2)
|
|
42
|
+
language_server-protocol (3.17.0.3)
|
|
43
|
+
mini_portile2 (2.8.6)
|
|
44
|
+
minitest (5.22.3)
|
|
45
|
+
mutex_m (0.2.0)
|
|
46
|
+
parallel (1.24.0)
|
|
47
|
+
parser (3.3.1.0)
|
|
35
48
|
ast (~> 2.4.1)
|
|
49
|
+
racc
|
|
50
|
+
racc (1.7.3)
|
|
36
51
|
rainbow (3.1.1)
|
|
37
|
-
rake (13.
|
|
38
|
-
regexp_parser (2.
|
|
39
|
-
rexml (3.2.
|
|
40
|
-
rspec (3.
|
|
41
|
-
rspec-core (~> 3.
|
|
42
|
-
rspec-expectations (~> 3.
|
|
43
|
-
rspec-mocks (~> 3.
|
|
44
|
-
rspec-core (3.
|
|
45
|
-
rspec-support (~> 3.
|
|
46
|
-
rspec-expectations (3.
|
|
52
|
+
rake (13.2.1)
|
|
53
|
+
regexp_parser (2.9.0)
|
|
54
|
+
rexml (3.2.6)
|
|
55
|
+
rspec (3.13.0)
|
|
56
|
+
rspec-core (~> 3.13.0)
|
|
57
|
+
rspec-expectations (~> 3.13.0)
|
|
58
|
+
rspec-mocks (~> 3.13.0)
|
|
59
|
+
rspec-core (3.13.0)
|
|
60
|
+
rspec-support (~> 3.13.0)
|
|
61
|
+
rspec-expectations (3.13.0)
|
|
47
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
48
|
-
rspec-support (~> 3.
|
|
49
|
-
rspec-mocks (3.
|
|
63
|
+
rspec-support (~> 3.13.0)
|
|
64
|
+
rspec-mocks (3.13.0)
|
|
50
65
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
51
|
-
rspec-support (~> 3.
|
|
52
|
-
rspec-support (3.
|
|
53
|
-
rubocop (1.
|
|
66
|
+
rspec-support (~> 3.13.0)
|
|
67
|
+
rspec-support (3.13.1)
|
|
68
|
+
rubocop (1.63.4)
|
|
69
|
+
json (~> 2.3)
|
|
70
|
+
language_server-protocol (>= 3.17.0)
|
|
54
71
|
parallel (~> 1.10)
|
|
55
|
-
parser (>= 3.
|
|
72
|
+
parser (>= 3.3.0.2)
|
|
56
73
|
rainbow (>= 2.2.2, < 4.0)
|
|
57
74
|
regexp_parser (>= 1.8, < 3.0)
|
|
58
|
-
rexml
|
|
59
|
-
rubocop-ast (>= 1.
|
|
75
|
+
rexml (>= 3.2.5, < 4.0)
|
|
76
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
|
60
77
|
ruby-progressbar (~> 1.7)
|
|
61
|
-
unicode-display_width (>=
|
|
62
|
-
rubocop-ast (1.
|
|
63
|
-
parser (>= 3.
|
|
64
|
-
rubocop-
|
|
65
|
-
rubocop (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
|
79
|
+
rubocop-ast (1.31.3)
|
|
80
|
+
parser (>= 3.3.1.0)
|
|
81
|
+
rubocop-capybara (2.20.0)
|
|
82
|
+
rubocop (~> 1.41)
|
|
83
|
+
rubocop-factory_bot (2.25.1)
|
|
84
|
+
rubocop (~> 1.41)
|
|
85
|
+
rubocop-performance (1.21.0)
|
|
86
|
+
rubocop (>= 1.48.1, < 2.0)
|
|
87
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
|
88
|
+
rubocop-rspec (2.29.2)
|
|
89
|
+
rubocop (~> 1.40)
|
|
90
|
+
rubocop-capybara (~> 2.17)
|
|
91
|
+
rubocop-factory_bot (~> 2.22)
|
|
92
|
+
rubocop-rspec_rails (~> 2.28)
|
|
93
|
+
rubocop-rspec_rails (2.28.3)
|
|
94
|
+
rubocop (~> 1.40)
|
|
95
|
+
ruby-progressbar (1.13.0)
|
|
70
96
|
simplecov (0.21.2)
|
|
71
97
|
docile (~> 1.1)
|
|
72
98
|
simplecov-html (~> 0.11)
|
|
73
99
|
simplecov_json_formatter (~> 0.1)
|
|
74
100
|
simplecov-html (0.12.3)
|
|
75
101
|
simplecov_json_formatter (0.1.4)
|
|
76
|
-
sqlite3 (1.
|
|
77
|
-
|
|
102
|
+
sqlite3 (1.7.3)
|
|
103
|
+
mini_portile2 (~> 2.8.0)
|
|
104
|
+
timeout (0.4.1)
|
|
105
|
+
tzinfo (2.0.6)
|
|
78
106
|
concurrent-ruby (~> 1.0)
|
|
79
|
-
unicode-display_width (2.
|
|
80
|
-
zeitwerk (2.5.4)
|
|
107
|
+
unicode-display_width (2.5.0)
|
|
81
108
|
|
|
82
109
|
PLATFORMS
|
|
83
110
|
ruby
|
|
84
111
|
|
|
85
112
|
DEPENDENCIES
|
|
86
|
-
activerecord (~>
|
|
113
|
+
activerecord (~> 7.0)
|
|
87
114
|
codecov (~> 0.6.0)
|
|
88
|
-
database_cleaner-active_record (~> 1
|
|
115
|
+
database_cleaner-active_record (~> 2.1)
|
|
89
116
|
light-services!
|
|
90
|
-
rake (~> 13.
|
|
91
|
-
rspec (~> 3.
|
|
92
|
-
rubocop (~> 1.
|
|
93
|
-
rubocop-performance (~> 1.
|
|
94
|
-
rubocop-rspec (~> 2.
|
|
117
|
+
rake (~> 13.2)
|
|
118
|
+
rspec (~> 3.13)
|
|
119
|
+
rubocop (~> 1.63)
|
|
120
|
+
rubocop-performance (~> 1.21)
|
|
121
|
+
rubocop-rspec (~> 2.29)
|
|
95
122
|
simplecov (~> 0.21)
|
|
96
|
-
sqlite3 (~> 1.
|
|
123
|
+
sqlite3 (~> 1.7)
|
|
97
124
|
|
|
98
125
|
BUNDLED WITH
|
|
99
|
-
2.
|
|
126
|
+
2.5.10
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# 🚀 Light Services
|
|
1
|
+
# 🚀 Light Services
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An implementation of the Service Object pattern for Ruby and Rails applications.
|
|
4
4
|
|
|
5
5
|
## 👀 Table of Contents
|
|
6
6
|
1. [Simple Example](#simple-example)
|
|
@@ -14,35 +14,34 @@ Implementation of Service Object pattern for Ruby/Rails applications.
|
|
|
14
14
|
|
|
15
15
|
## 💪 Features
|
|
16
16
|
|
|
17
|
-
1. Ability to define `arguments`, `steps
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
1. Ability to define `arguments`, `steps`, and `outputs`
|
|
18
|
+
1. Isolated behavior of each service object
|
|
19
|
+
1. Errors raise to stop processing subsequent steps
|
|
20
|
+
1. Wrapping actions in database transactions
|
|
21
|
+
1. Ability to pass context to child service objects
|
|
22
|
+
1. Framework agnostic
|
|
23
|
+
1. 100% test coverage
|
|
24
24
|
|
|
25
25
|
## ❌ Problems
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
This gem was initially intended for internal use and has several issues:
|
|
28
28
|
|
|
29
|
-
1.
|
|
30
|
-
|
|
31
|
-
3. Repo doesn't have any CI/CD
|
|
29
|
+
1. The gem is not well-documented
|
|
30
|
+
1. The code lacks comments
|
|
32
31
|
|
|
33
32
|
## Installation
|
|
34
33
|
|
|
35
34
|
Add this line to your application's Gemfile:
|
|
36
35
|
|
|
37
36
|
```ruby
|
|
38
|
-
gem
|
|
37
|
+
gem "light-services", "~> 2.0"
|
|
39
38
|
```
|
|
40
39
|
|
|
41
40
|
## Simple Example
|
|
42
41
|
|
|
43
|
-
### Send
|
|
42
|
+
### Send Notification
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
Create a basic service object that sends a notification to a user.
|
|
46
45
|
|
|
47
46
|
```ruby
|
|
48
47
|
class User::SendNotification < ApplicationService
|
|
@@ -84,7 +83,7 @@ end
|
|
|
84
83
|
|
|
85
84
|
### Arguments
|
|
86
85
|
|
|
87
|
-
|
|
86
|
+
Pass arguments into the service object as shown:
|
|
88
87
|
|
|
89
88
|
**How to define arguments:**
|
|
90
89
|
```ruby
|
|
@@ -106,7 +105,7 @@ class User::SendNotification < ApplicationService
|
|
|
106
105
|
end
|
|
107
106
|
```
|
|
108
107
|
|
|
109
|
-
**How to pass arguments
|
|
108
|
+
**How to pass arguments from a controller:**
|
|
110
109
|
```ruby
|
|
111
110
|
class UsersController
|
|
112
111
|
def send_notification
|
|
@@ -116,7 +115,7 @@ class UsersController
|
|
|
116
115
|
end
|
|
117
116
|
```
|
|
118
117
|
|
|
119
|
-
**
|
|
118
|
+
**Passing arguments and context from parent to child service object:**
|
|
120
119
|
```ruby
|
|
121
120
|
class User::Update
|
|
122
121
|
# Arguments
|
|
@@ -132,15 +131,15 @@ class User::Update
|
|
|
132
131
|
|
|
133
132
|
def send_notification
|
|
134
133
|
User::SendNotification
|
|
135
|
-
.with(self) #
|
|
136
|
-
.run(text: "Your profile was updated") #
|
|
134
|
+
.with(self) # Specifies the current service object as parent, passing all context arguments to a child service object
|
|
135
|
+
.run(text: "Your profile was updated") # No need to pass `user` as it's a context argument
|
|
137
136
|
end
|
|
138
137
|
end
|
|
139
138
|
```
|
|
140
139
|
|
|
141
140
|
### Steps
|
|
142
141
|
|
|
143
|
-
Steps are a bit more powerful than
|
|
142
|
+
Steps are a bit more powerful than they appear.
|
|
144
143
|
|
|
145
144
|
```ruby
|
|
146
145
|
class User::Charge
|
|
@@ -160,7 +159,7 @@ end
|
|
|
160
159
|
|
|
161
160
|
### Outputs
|
|
162
161
|
|
|
163
|
-
Outputs are
|
|
162
|
+
Outputs are straightforward.
|
|
164
163
|
|
|
165
164
|
```ruby
|
|
166
165
|
class User::Charge
|
|
@@ -176,9 +175,9 @@ end
|
|
|
176
175
|
|
|
177
176
|
The context specifies the relationship between parent and child service objects.
|
|
178
177
|
|
|
179
|
-
What context does:
|
|
180
|
-
1.
|
|
181
|
-
|
|
178
|
+
What the context does:
|
|
179
|
+
1. Tells the parent service object to pass context arguments to a child service object.
|
|
180
|
+
1. Informs the parent service object to also fail when the child service object fails (this is customizable).
|
|
182
181
|
|
|
183
182
|
```ruby
|
|
184
183
|
class User::Charge
|
|
@@ -216,9 +215,9 @@ end
|
|
|
216
215
|
|
|
217
216
|
## Complex Example
|
|
218
217
|
|
|
219
|
-
### Creation
|
|
218
|
+
### Record Creation
|
|
220
219
|
|
|
221
|
-
|
|
220
|
+
Explore a more intricate example of creating database records.
|
|
222
221
|
|
|
223
222
|
**Here is an example of controller (pretty thin, yeah? but we can make it even thinner):**
|
|
224
223
|
```ruby
|
|
@@ -319,7 +318,7 @@ end
|
|
|
319
318
|
## More examples
|
|
320
319
|
|
|
321
320
|
You can find more examples here:
|
|
322
|
-
[https://github.com/light-ruby/light-services/tree/
|
|
321
|
+
[https://github.com/light-ruby/light-services/tree/spec/data/services](https://github.com/light-ruby/light-services/tree/v2/spec/data/services)
|
|
323
322
|
|
|
324
323
|
# Happy coding!
|
|
325
324
|
|
data/lib/light/services/base.rb
CHANGED
|
@@ -76,7 +76,7 @@ module Light
|
|
|
76
76
|
|
|
77
77
|
def insert_item(klass, name, opts, item)
|
|
78
78
|
index = find_index(klass, opts[:before] || opts[:after])
|
|
79
|
-
index
|
|
79
|
+
index += 1 unless opts[:before]
|
|
80
80
|
|
|
81
81
|
@collection[klass] = @collection[klass].to_a.insert(index, [name, item]).to_h
|
|
82
82
|
end
|
|
@@ -13,18 +13,18 @@ module Light
|
|
|
13
13
|
module ClassBasedCollection
|
|
14
14
|
module Mount
|
|
15
15
|
def mount_class_based_collection(collection_name, item_class:, shortcut:, allow_redefine: false)
|
|
16
|
-
class_variable_set("@@#{collection_name}", ClassBasedCollection::Base.new(item_class, allow_redefine))
|
|
16
|
+
class_variable_set(:"@@#{collection_name}", ClassBasedCollection::Base.new(item_class, allow_redefine))
|
|
17
17
|
|
|
18
18
|
define_singleton_method shortcut do |item_name, opts = {}|
|
|
19
|
-
class_variable_get("@@#{collection_name}").add(self, item_name, opts)
|
|
19
|
+
class_variable_get(:"@@#{collection_name}").add(self, item_name, opts)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
define_singleton_method "remove_#{shortcut}" do |item_name|
|
|
23
|
-
class_variable_get("@@#{collection_name}").remove(self, item_name)
|
|
22
|
+
define_singleton_method :"remove_#{shortcut}" do |item_name|
|
|
23
|
+
class_variable_get(:"@@#{collection_name}").remove(self, item_name)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
define_singleton_method collection_name do
|
|
27
|
-
class_variable_get("@@#{collection_name}").all(self)
|
|
27
|
+
class_variable_get(:"@@#{collection_name}").all(self)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -38,11 +38,11 @@ module Light
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def set(key, value)
|
|
41
|
-
instance_variable_set("@#{key}", value)
|
|
41
|
+
instance_variable_set(:"@#{key}", value)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def get(key)
|
|
45
|
-
instance_variable_get("@#{key}")
|
|
45
|
+
instance_variable_get(:"@#{key}")
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def reset_to_defaults!
|
|
@@ -52,7 +52,7 @@ module Light
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def to_h
|
|
55
|
-
DEFAULTS.keys.
|
|
55
|
+
DEFAULTS.keys.to_h { |key| [key, get(key)] }
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def merge(config)
|
|
@@ -46,7 +46,7 @@ module Light
|
|
|
46
46
|
|
|
47
47
|
@arg_types_cache[klass] ||= klass
|
|
48
48
|
.name
|
|
49
|
-
.gsub(
|
|
49
|
+
.gsub("::", "/")
|
|
50
50
|
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
|
51
51
|
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
|
52
52
|
.tr("-", "_")
|
|
@@ -58,8 +58,8 @@ module Light
|
|
|
58
58
|
name = @name
|
|
59
59
|
|
|
60
60
|
@service_class.define_method(@name) { @arguments.get(name) }
|
|
61
|
-
@service_class.define_method("#{@name}?") { !!@arguments.get(name) }
|
|
62
|
-
@service_class.define_method("#{@name}=") { |value| @arguments.set(name, value) }
|
|
61
|
+
@service_class.define_method(:"#{@name}?") { !!@arguments.get(name) }
|
|
62
|
+
@service_class.define_method(:"#{@name}=") { |value| @arguments.set(name, value) }
|
|
63
63
|
@service_class.send(:private, "#{@name}=")
|
|
64
64
|
end
|
|
65
65
|
end
|
|
@@ -24,8 +24,8 @@ module Light
|
|
|
24
24
|
name = @name
|
|
25
25
|
|
|
26
26
|
@service_class.define_method(@name) { @outputs.get(name) }
|
|
27
|
-
@service_class.define_method("#{@name}?") { !!@outputs.get(name) }
|
|
28
|
-
@service_class.define_method("#{@name}=") { |value| @outputs.set(name, value) }
|
|
27
|
+
@service_class.define_method(:"#{@name}?") { !!@outputs.get(name) }
|
|
28
|
+
@service_class.define_method(:"#{@name}=") { |value| @outputs.set(name, value) }
|
|
29
29
|
@service_class.send(:private, "#{@name}=")
|
|
30
30
|
end
|
|
31
31
|
end
|
data/light-services.gemspec
CHANGED
|
@@ -5,11 +5,11 @@ require_relative "lib/light/services/version"
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "light-services"
|
|
7
7
|
spec.version = Light::Services::VERSION
|
|
8
|
-
spec.authors = ["Andrew
|
|
9
|
-
spec.email = ["
|
|
8
|
+
spec.authors = ["Andrew Kodkod"]
|
|
9
|
+
spec.email = ["andrew@kodkod.me"]
|
|
10
10
|
|
|
11
|
-
spec.summary = "
|
|
12
|
-
spec.description = "
|
|
11
|
+
spec.summary = "Streamlined Service Object Implementation for Ruby and Rails"
|
|
12
|
+
spec.description = "Streamlined Service Object Implementation for Ruby and Rails"
|
|
13
13
|
spec.homepage = "https://github.com/light-ruby/light-services"
|
|
14
14
|
spec.license = "MIT"
|
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
metadata
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: light-services
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0
|
|
4
|
+
version: '2.0'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Andrew
|
|
7
|
+
- Andrew Kodkod
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-05-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description:
|
|
13
|
+
description: Streamlined Service Object Implementation for Ruby and Rails
|
|
14
14
|
email:
|
|
15
|
-
-
|
|
15
|
+
- andrew@kodkod.me
|
|
16
16
|
executables: []
|
|
17
17
|
extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
|
@@ -22,6 +22,7 @@ files:
|
|
|
22
22
|
- ".gitignore"
|
|
23
23
|
- ".rspec"
|
|
24
24
|
- ".rubocop.yml"
|
|
25
|
+
- ".ruby-version"
|
|
25
26
|
- CHANGELOG.md
|
|
26
27
|
- CODE_OF_CONDUCT.md
|
|
27
28
|
- Gemfile
|
|
@@ -68,12 +69,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
68
69
|
version: 2.3.0
|
|
69
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
71
|
requirements:
|
|
71
|
-
- - "
|
|
72
|
+
- - ">="
|
|
72
73
|
- !ruby/object:Gem::Version
|
|
73
|
-
version:
|
|
74
|
+
version: '0'
|
|
74
75
|
requirements: []
|
|
75
|
-
rubygems_version: 3.
|
|
76
|
+
rubygems_version: 3.5.9
|
|
76
77
|
signing_key:
|
|
77
78
|
specification_version: 4
|
|
78
|
-
summary:
|
|
79
|
+
summary: Streamlined Service Object Implementation for Ruby and Rails
|
|
79
80
|
test_files: []
|