mu-result 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +4 -2
- data/lib/mu/result.rb +2 -27
- data/lib/mu/result/base_result.rb +33 -0
- data/lib/mu/result/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec6059760dd74a847a598f17b84dee0ad3028a2c5c6e7afd5b8bf5a8815c0922
|
4
|
+
data.tar.gz: fde0c2077ce8690b98bba79c9b8a9654c11f3db221a7220807c8840e9b9a9140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7976d5f7fa13447ce500aa913327a02440cf3590e2e01543e6c7362d096cf91beeca8693cfc9bad11bd6dc892c35279865d8ebf25fd06b808202b2bdd9f058c
|
7
|
+
data.tar.gz: eeb98d41c5add154fe3abe0878f0ea0417f842498e1d9904c1582e31e168f81baeec4b6e745466fd9d1e7f9d424268ec08ab5c5f98661982b844bc3c9a8d3ee3
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Mu::Result
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/mu-result.svg)](https://badge.fury.io/rb/mu-result)
|
4
|
+
|
3
5
|
This is a really tiny implementation of the Result object.
|
4
6
|
|
5
7
|
## Installation
|
@@ -40,8 +42,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
40
42
|
|
41
43
|
## Contributing
|
42
44
|
|
43
|
-
Bug reports and pull requests are welcome
|
45
|
+
Bug reports and pull requests are welcome at https://source.olisti.co/olistik/mu-result. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
44
46
|
|
45
47
|
## Code of Conduct
|
46
48
|
|
47
|
-
Everyone interacting in the Mu::Result project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://
|
49
|
+
Everyone interacting in the Mu::Result project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://source.olisti.co/olistik/mu-result/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/mu/result.rb
CHANGED
@@ -1,34 +1,8 @@
|
|
1
1
|
require 'mu/result/version'
|
2
|
+
require 'mu/result/base_result'
|
2
3
|
|
3
4
|
module Mu
|
4
5
|
module Result
|
5
|
-
class BaseResult
|
6
|
-
def initialize(code: :ok, data: nil)
|
7
|
-
@code = code
|
8
|
-
@data = data
|
9
|
-
end
|
10
|
-
|
11
|
-
def code!(value)
|
12
|
-
@code = value
|
13
|
-
self
|
14
|
-
end
|
15
|
-
|
16
|
-
def code
|
17
|
-
@code
|
18
|
-
end
|
19
|
-
|
20
|
-
def data
|
21
|
-
@data
|
22
|
-
end
|
23
|
-
|
24
|
-
def success?
|
25
|
-
@code == :ok
|
26
|
-
end
|
27
|
-
|
28
|
-
def error?
|
29
|
-
!success?
|
30
|
-
end
|
31
|
-
end
|
32
6
|
|
33
7
|
def self.success(data = nil)
|
34
8
|
BaseResult.new(code: :ok, data: data)
|
@@ -37,5 +11,6 @@ module Mu
|
|
37
11
|
def self.error(data = nil)
|
38
12
|
BaseResult.new(code: :ko, data: data)
|
39
13
|
end
|
14
|
+
|
40
15
|
end
|
41
16
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Mu
|
2
|
+
module Result
|
3
|
+
|
4
|
+
class BaseResult
|
5
|
+
def initialize(code: :ok, data: nil)
|
6
|
+
@code = code
|
7
|
+
@data = data
|
8
|
+
end
|
9
|
+
|
10
|
+
def code!(value)
|
11
|
+
@code = value
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def code
|
16
|
+
@code
|
17
|
+
end
|
18
|
+
|
19
|
+
def data
|
20
|
+
@data
|
21
|
+
end
|
22
|
+
|
23
|
+
def success?
|
24
|
+
@code == :ok
|
25
|
+
end
|
26
|
+
|
27
|
+
def error?
|
28
|
+
!success?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/lib/mu/result/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mu-result
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- olistik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- bin/console
|
71
71
|
- bin/setup
|
72
72
|
- lib/mu/result.rb
|
73
|
+
- lib/mu/result/base_result.rb
|
73
74
|
- lib/mu/result/version.rb
|
74
75
|
- mu-result.gemspec
|
75
76
|
homepage: https://source.olisti.co/olistik/mu-result
|
@@ -91,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
92
|
- !ruby/object:Gem::Version
|
92
93
|
version: '0'
|
93
94
|
requirements: []
|
94
|
-
|
95
|
-
rubygems_version: 2.7.8
|
95
|
+
rubygems_version: 3.0.6
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: μResult is a small Result object
|