light-service 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -4
- data/RELEASES.md +3 -0
- data/Rakefile +1 -2
- data/lib/light-service/context.rb +6 -3
- data/lib/light-service/context/key_verifier.rb +2 -2
- data/lib/light-service/organizer.rb +1 -1
- data/lib/light-service/version.rb +1 -1
- data/light-service.gemspec +1 -1
- data/spec/action_spec.rb +1 -1
- data/spec/context_spec.rb +8 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa927bdc5eaab0a8eed9f198bf61c28c042dc530
|
4
|
+
data.tar.gz: 6855d34240f37a93ef2ece590074eabd30ff901d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bb0724f04a18663620795c3f53fa048e88a6a07d441dd2250f1e0121f68f5b7f3d108aeb4ff64155ec83f6151756efc2f695df071d2f77dc14c3519380abddb
|
7
|
+
data.tar.gz: be037dc8236f1d38b860e912226e28a951db55be761c6b3f8591adf4404c1d61b367538ee4bd9c6595d546e50d206604529b71ed6ddefe59cd93e0a7a68cb5e6
|
data/.rubocop.yml
CHANGED
@@ -18,7 +18,7 @@ Style/Encoding:
|
|
18
18
|
Style/StringLiterals:
|
19
19
|
Enabled: false
|
20
20
|
|
21
|
-
Style/
|
21
|
+
Style/FormatStringToken:
|
22
22
|
Enabled: false
|
23
23
|
|
24
24
|
Style/RedundantReturn:
|
@@ -30,11 +30,19 @@ Style/SignalException:
|
|
30
30
|
Style/HashSyntax:
|
31
31
|
EnforcedStyle: hash_rockets
|
32
32
|
|
33
|
-
Style/PredicateName:
|
34
|
-
Enabled: false
|
35
|
-
|
36
33
|
Style/TrivialAccessors:
|
37
34
|
AllowPredicates: true
|
38
35
|
|
36
|
+
Naming/PredicateName:
|
37
|
+
Enabled: false
|
38
|
+
|
39
39
|
Metrics/MethodLength:
|
40
40
|
Max: 15
|
41
|
+
|
42
|
+
Metrics/BlockLength:
|
43
|
+
Max: 35
|
44
|
+
Exclude:
|
45
|
+
- 'spec/**/*.rb'
|
46
|
+
|
47
|
+
Layout/TrailingBlankLines:
|
48
|
+
Enabled: false
|
data/RELEASES.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
A brief list of new features and changes introduced with the specified version.
|
2
2
|
|
3
|
+
### 0.8.4
|
4
|
+
* Only pass [default argument](https://github.com/adomokos/light-service/pull/123) to Hash#fetch in context if no block given.
|
5
|
+
|
3
6
|
### 0.8.3
|
4
7
|
* Make logging more [efficient](https://github.com/adomokos/light-service/pull/120) the context.
|
5
8
|
|
data/Rakefile
CHANGED
@@ -19,7 +19,6 @@ module LightService
|
|
19
19
|
@error_code = error_code
|
20
20
|
@skip_remaining = false
|
21
21
|
context.to_hash.each { |k, v| self[k] = v }
|
22
|
-
self
|
23
22
|
end
|
24
23
|
|
25
24
|
def self.make(context = {})
|
@@ -140,8 +139,12 @@ module LightService
|
|
140
139
|
return super(key)
|
141
140
|
end
|
142
141
|
|
143
|
-
def fetch(key,
|
144
|
-
self[key] ||=
|
142
|
+
def fetch(key, default = nil, &blk)
|
143
|
+
self[key] ||= if block_given?
|
144
|
+
super(key, &blk)
|
145
|
+
else
|
146
|
+
super
|
147
|
+
end
|
145
148
|
end
|
146
149
|
|
147
150
|
def inspect
|
@@ -10,7 +10,7 @@ module LightService
|
|
10
10
|
|
11
11
|
def are_all_keys_in_context?(keys)
|
12
12
|
not_found_keys = keys_not_found(keys)
|
13
|
-
|
13
|
+
not_found_keys.none?
|
14
14
|
end
|
15
15
|
|
16
16
|
def keys_not_found(keys)
|
@@ -111,7 +111,7 @@ module LightService
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def reserved_keys
|
114
|
-
[
|
114
|
+
%i[message error_code current_action].freeze
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
@@ -17,7 +17,7 @@ module LightService
|
|
17
17
|
# In case this module is included
|
18
18
|
module ClassMethods
|
19
19
|
def with(data = {})
|
20
|
-
VerifyCallMethodExists.call(self, caller.first)
|
20
|
+
VerifyCallMethodExists.call(self, caller(1..1).first)
|
21
21
|
data[:_aliases] = @aliases if @aliases
|
22
22
|
WithReducerFactory.make(self).with(data)
|
23
23
|
end
|
data/light-service.gemspec
CHANGED
@@ -20,6 +20,6 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
gem.add_development_dependency("rspec", "~> 3.0")
|
22
22
|
gem.add_development_dependency("simplecov", "~> 0.14.1")
|
23
|
-
gem.add_development_dependency("rubocop", "0.
|
23
|
+
gem.add_development_dependency("rubocop", "~> 0.51")
|
24
24
|
gem.add_development_dependency("pry", "~> 0.10")
|
25
25
|
end
|
data/spec/action_spec.rb
CHANGED
data/spec/context_spec.rb
CHANGED
@@ -162,6 +162,14 @@ RSpec.describe LightService::Context do
|
|
162
162
|
expect(context[:foo]).to eq false
|
163
163
|
end
|
164
164
|
|
165
|
+
it "allows a default value for #fetch" do
|
166
|
+
expect(context.fetch(:madeup, :default)).to eq(:default)
|
167
|
+
end
|
168
|
+
|
169
|
+
it "allows a default block value for #fetch" do
|
170
|
+
expect(context.fetch(:madeup) { :default }).to eq(:default)
|
171
|
+
end
|
172
|
+
|
165
173
|
context "when aliases are included via .make" do
|
166
174
|
let(:context) do
|
167
175
|
LightService::Context.make(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: light-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Attila Domokos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.51'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.51'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|