light_service_object 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/lib/light_service_object/version.rb +1 -1
- data/lib/light_service_object.rb +4 -6
- 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: 5399fbbb110d76af5d9896f96402263cb4a9f30bfb8df779191b8916042e9459
|
4
|
+
data.tar.gz: 59af280aabe4ec713eaaae21052588e44d49f99b8e4ee9087e8bcc2a56eb0e76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 729aa785bf0fb2cc4d09a930698eb7fb38dc09d2269ae7a362faf5ea3081ae8d0c7190e4a8873dc873c7f60659b739fa2a30d2f1eeca8b973039af7d65d41584
|
7
|
+
data.tar.gz: ac5211863dc686c664a386816edc8a9a6bed261de368fcc9b573d94a9c090c70ed742a7e4407cbfd260f58f62cf90b1e1f7c4db6a9c6bc9102b72ed1fe87050f
|
data/README.md
CHANGED
@@ -54,8 +54,8 @@ class NewServiceObject < LightServiceObject::Base
|
|
54
54
|
optional :number
|
55
55
|
|
56
56
|
def perform
|
57
|
-
fail!("Date is too far away") if date - Date.today >= 7
|
58
|
-
|
57
|
+
fail!("Date is too far away") if date - Date.today >= 7
|
58
|
+
|
59
59
|
number + 10
|
60
60
|
end
|
61
61
|
end
|
@@ -67,6 +67,9 @@ end
|
|
67
67
|
- the last thing evaluated will be returned as the result `number + 10`
|
68
68
|
- one side note: all parameters are immutable by default
|
69
69
|
|
70
|
+
### Why is it Light?
|
71
|
+
|
72
|
+
It really is just a plain-old-ruby-object (PORO) with `Dry::Initializer` throw in with some syntax grease, and returns a `Dry::Monads::Result` -- that's it.
|
70
73
|
|
71
74
|
## Contributing
|
72
75
|
|
data/lib/light_service_object.rb
CHANGED
@@ -71,12 +71,10 @@ module LightServiceObject
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def call(**options)
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
Dry::Monads.Failure(error.message)
|
79
|
-
end
|
74
|
+
obj = self.new(**options)
|
75
|
+
obj.call
|
76
|
+
rescue Exception => error
|
77
|
+
Dry::Monads.Failure(error.message)
|
80
78
|
end
|
81
79
|
end
|
82
80
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: light_service_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Sharpe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|