light-services 2.0 → 2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8a693c78f413c2ca03c2381e2bf4ae82355d3546eb8c4a2418181ed6c0a2205
4
- data.tar.gz: 68dd61477720f1c5ec6f5702b088c3a1a7251e3ee008b963e27924ec1d6142aa
3
+ metadata.gz: 1e777268364638a43bc06d7daab56a5cd8a70e302f782df56e657de079c370f9
4
+ data.tar.gz: 7b04287f111ded9b9ead0ae46b5c6696fa8f32c8e4c39c6658e6538008c25b51
5
5
  SHA512:
6
- metadata.gz: 76b9503f757f4135648f02a7ce128bd2a82b3eb4350fd42fb6abf12867e8321d1930d77936983925441e2aed28bef65a976e147853290076b1314ad2a2ebb8bb
7
- data.tar.gz: 96646aa52768b79fb0255a5a9209444171ccd10b4a42d761888e7e51ca417e254bef4668a216ac389eeec0d7133a42343ae26714cddb8ee6150a341c601d16d1
6
+ metadata.gz: d88dd74e63c77525cb7d3771133a6afab9303bce64039255ef74d8a8e6104469e90a315e6fa6f917562d8d6f615a65f7d75e51ecfeac278968e373cd6b84f0ec
7
+ data.tar.gz: 2e05b2f401f9e7a93a95081e91cc160c923cab2bff2f2f7a3193c114edea26bc8cc624d9fb4d5af27faa1fab474bc3994f9d71bf4884de78ceda16293255fc50
data/.rubocop.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  require:
2
+ - rubocop-rake
2
3
  - rubocop-rspec
3
4
  - rubocop-performance
4
5
 
@@ -19,6 +20,9 @@ Security/Eval:
19
20
  Style/Documentation:
20
21
  Enabled: false
21
22
 
23
+ Style/ClassVars:
24
+ Enabled: false
25
+
22
26
  Style/StringLiterals:
23
27
  EnforcedStyle: double_quotes
24
28
 
data/Gemfile CHANGED
@@ -14,7 +14,8 @@ group :test do
14
14
  gem "rspec", "~> 3.13"
15
15
  gem "simplecov", "~> 0.21"
16
16
 
17
- gem "rubocop", "~> 1.63", require: false
18
- gem "rubocop-rspec", "~> 2.29", require: false
17
+ gem "rubocop", "~> 1.64", require: false
19
18
  gem "rubocop-performance", "~> 1.21", require: false
19
+ gem "rubocop-rake", "~> 0.6.0", require: false
20
+ gem "rubocop-rspec", "~> 2.30", require: false
20
21
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- light-services (2.0)
4
+ light-services (2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -50,8 +50,9 @@ GEM
50
50
  racc (1.7.3)
51
51
  rainbow (3.1.1)
52
52
  rake (13.2.1)
53
- regexp_parser (2.9.0)
54
- rexml (3.2.6)
53
+ regexp_parser (2.9.2)
54
+ rexml (3.2.8)
55
+ strscan (>= 3.0.9)
55
56
  rspec (3.13.0)
56
57
  rspec-core (~> 3.13.0)
57
58
  rspec-expectations (~> 3.13.0)
@@ -65,7 +66,7 @@ GEM
65
66
  diff-lcs (>= 1.2.0, < 2.0)
66
67
  rspec-support (~> 3.13.0)
67
68
  rspec-support (3.13.1)
68
- rubocop (1.63.4)
69
+ rubocop (1.64.1)
69
70
  json (~> 2.3)
70
71
  language_server-protocol (>= 3.17.0)
71
72
  parallel (~> 1.10)
@@ -85,7 +86,9 @@ GEM
85
86
  rubocop-performance (1.21.0)
86
87
  rubocop (>= 1.48.1, < 2.0)
87
88
  rubocop-ast (>= 1.31.1, < 2.0)
88
- rubocop-rspec (2.29.2)
89
+ rubocop-rake (0.6.0)
90
+ rubocop (~> 1.0)
91
+ rubocop-rspec (2.30.0)
89
92
  rubocop (~> 1.40)
90
93
  rubocop-capybara (~> 2.17)
91
94
  rubocop-factory_bot (~> 2.22)
@@ -101,6 +104,7 @@ GEM
101
104
  simplecov_json_formatter (0.1.4)
102
105
  sqlite3 (1.7.3)
103
106
  mini_portile2 (~> 2.8.0)
107
+ strscan (3.1.0)
104
108
  timeout (0.4.1)
105
109
  tzinfo (2.0.6)
106
110
  concurrent-ruby (~> 1.0)
@@ -116,9 +120,10 @@ DEPENDENCIES
116
120
  light-services!
117
121
  rake (~> 13.2)
118
122
  rspec (~> 3.13)
119
- rubocop (~> 1.63)
123
+ rubocop (~> 1.64)
120
124
  rubocop-performance (~> 1.21)
121
- rubocop-rspec (~> 2.29)
125
+ rubocop-rake (~> 0.6.0)
126
+ rubocop-rspec (~> 2.30)
122
127
  simplecov (~> 0.21)
123
128
  sqlite3 (~> 1.7)
124
129
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 🚀 Light Services
2
2
 
3
- An implementation of the Service Object pattern for Ruby and Rails applications.
3
+ A streamlined Service Object implementation for Ruby and Rails, tested in multiple SaaS applications with hundreds of service objects. This gem offers a reliable framework for organizing business logic effectively.
4
4
 
5
5
  ## 👀 Table of Contents
6
6
  1. [Simple Example](#simple-example)
@@ -36,7 +36,7 @@ module Light
36
36
  attr_reader :outputs, :arguments, :errors, :warnings
37
37
 
38
38
  def initialize(args = {}, config = {}, parent_service = nil)
39
- @config = Light::Services.config.merge(config)
39
+ @config = Light::Services.config.merge(self.class.class_config || {}).merge(config)
40
40
  @parent_service = parent_service
41
41
 
42
42
  @outputs = Collection::Outputs.new(self)
@@ -95,12 +95,18 @@ module Light
95
95
  end
96
96
 
97
97
  class << self
98
+ attr_accessor :class_config
99
+
100
+ def config(config = {})
101
+ self.class_config = config
102
+ end
103
+
98
104
  def run(args = {}, config = {})
99
105
  new(args, config).tap(&:call)
100
106
  end
101
107
 
102
- def run!(args = {})
103
- run(args, raise_on_error: true)
108
+ def run!(args = {}, config = {})
109
+ run(args, config.merge(raise_on_error: true))
104
110
  end
105
111
 
106
112
  def with(service_or_config = {}, config = {})
@@ -19,7 +19,7 @@ module Light
19
19
  settings_collection.each do |name, settings|
20
20
  next if settings.optional && (!key?(name) || get(name).nil?)
21
21
 
22
- settings.valid_type?(get(name))
22
+ settings.validate_type!(get(name))
23
23
  end
24
24
  end
25
25
 
@@ -23,7 +23,7 @@ module Light
23
23
  define_methods
24
24
  end
25
25
 
26
- def valid_type?(value)
26
+ def validate_type!(value)
27
27
  return if !@type || [*@type].any? do |type|
28
28
  case type
29
29
  when :boolean
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Light
4
4
  module Services
5
- VERSION = "2.0"
5
+ VERSION = "2.1"
6
6
  end
7
7
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
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
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
16
16
 
17
17
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
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.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kodkod
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-04 00:00:00.000000000 Z
11
+ date: 2024-06-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Streamlined Service Object Implementation for Ruby and Rails
14
14
  email:
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 2.3.0
69
+ version: 2.7.0
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="