u-service 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6318b522443f18f20b9cc6d6df3df66bac3b47ec00c0cf634c8e5093cd1e9c8
4
- data.tar.gz: abe048fdae03253fca5e46ef35a7c95c104bdafedb32358983533470a46958b7
3
+ metadata.gz: 5726d2ecb67cd07b309e07b8df1efca7d5b3c1249f494eafd844fb1f09779424
4
+ data.tar.gz: 5ae6ec089cba9c0b2e82df8c04179aada1fa973ffb5ce05e9fb90d04de92ce7e
5
5
  SHA512:
6
- metadata.gz: 020b873f0b7c0326b5ad26c72c64a412ec4383709d626804af0147e2a80a9274a41228cb100332a41f12400c96a4251a8c900fe13851bf4ffaabbe7874ce488c
7
- data.tar.gz: d17ba3915f0fa3d1d69e0b02f46f0a14d44ea707255a78a3ac9386a9cf14e86201832b3f3c04cd3e4ead9f93323123092b752fcab5218355e538ecbcd4f9738e
6
+ metadata.gz: 84e07635d0b6763c90fd3ac17d413a2380eecf7a3b4d050b68483d25e95d7d94815f76c5019b0af360594aea660df2bc5147df8ae130391f5afb32c4857565a0
7
+ data.tar.gz: b7e863689304c30d7023b4a65107fd23bbb04804cff0628365d535d1f1c4bd044b0e0dcf11debab688b42e1c6f6042d484fc4fdf599e7832a6d3018305c97ec3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- u-service (0.4.0)
4
+ u-service (0.5.0)
5
5
  u-attributes (~> 1.1)
6
6
 
7
7
  GEM
data/lib/micro/service.rb CHANGED
@@ -5,5 +5,5 @@ require 'micro/attributes'
5
5
  require 'micro/service/version'
6
6
  require 'micro/service/result'
7
7
  require 'micro/service/base'
8
- require 'micro/service/strict/base'
8
+ require 'micro/service/strict'
9
9
  require 'micro/service/pipeline'
@@ -15,9 +15,7 @@ module Micro
15
15
  end
16
16
 
17
17
  def call(arg={})
18
- initial_result = Micro::Service::Result::Success(value: arg)
19
-
20
- @services.reduce(initial_result) do |result, service|
18
+ @services.reduce(initial_result(arg)) do |result, service|
21
19
  break result if result.failure?
22
20
  service.call(result.value)
23
21
  end
@@ -32,6 +30,11 @@ module Micro
32
30
  end
33
31
  end
34
32
  end
33
+
34
+ def initial_result(arg)
35
+ return arg if arg.is_a?(Micro::Service::Result)
36
+ Micro::Service::Result::Success(value: arg)
37
+ end
35
38
  end
36
39
  end
37
40
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Micro
4
+ module Service
5
+ class Strict < Service::Base
6
+ include Micro::Attributes::Features::StrictInitialize
7
+ end
8
+ end
9
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Micro
4
4
  module Service
5
- VERSION = '0.4.0'.freeze
5
+ VERSION = '0.5.0'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: u-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Serradura
@@ -87,7 +87,7 @@ files:
87
87
  - lib/micro/service/base.rb
88
88
  - lib/micro/service/pipeline.rb
89
89
  - lib/micro/service/result.rb
90
- - lib/micro/service/strict/base.rb
90
+ - lib/micro/service/strict.rb
91
91
  - lib/micro/service/version.rb
92
92
  - lib/micro/u-service.rb
93
93
  - u-service.gemspec
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Micro
4
- module Service
5
- module Strict
6
- class Base < Service::Base
7
- include Micro::Attributes::Features::StrictInitialize
8
- end
9
- end
10
- end
11
- end