arbitrium 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +2 -5
- data/arbitrium.gemspec +1 -1
- data/lib/arbitrium.rb +2 -1
- data/lib/arbitrium/result.rb +24 -0
- data/lib/arbitrium/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecc167d7ea5fe60069c5683338656ca849f2d892
|
4
|
+
data.tar.gz: bb5247460df31fa4ae2cad97ec69e21c63267cb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5562d12eef0fafc7b604f9524cc6b46d7d3f31b3ecf79d9deb68b00c2198c8a896fe80293bd1a5022670eaf1c5ef016bd8d3846f8d95cb46e20fb53f86e53e5
|
7
|
+
data.tar.gz: 3f766bb40d7fe3debf1f3244f1b8abff4b27bd0a0390c44ea2d4bbe7c2acfdc0a6748447d8562686d82345d84a0aafd219c0465b61eccb4b99b0f6ce1abb126a
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Arbitrium
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Arbitrium is a gem that gives a clear definition to service level classes and provides an object that will return the result. It is a plain-old-ruby gem that has no dependencies on Rails or any other framework. Please stay tuned, there are more features to come!
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,7 +20,7 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
To use this gem simply call Arbitrium::Result.new and pass in a boolean whether the build failed or not, a corresponding message, and then the optional object.
|
26
24
|
|
27
25
|
## Development
|
28
26
|
|
@@ -33,4 +31,3 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
33
31
|
## Contributing
|
34
32
|
|
35
33
|
Bug reports and pull requests are welcome on GitHub at https://github.com/Lollar/arbitrium.
|
36
|
-
|
data/arbitrium.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["lollar.mchl@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{An easy to use gem for creating service objects}
|
13
|
-
spec.description = %q{This gem was inspired by the overabundance of
|
13
|
+
spec.description = %q{This gem was inspired by the overabundance of logic that I continually saw in controllers in the Rails app I was working on. I've decided to implement a straight ruby gem that has no dependencies on Rails. This gem will remain simple in scope and will be modeled after the way that I like to write service object classes.}
|
14
14
|
spec.homepage = "https://github.com/lollar/arbitrium"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
data/lib/arbitrium.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Arbitrium
|
2
|
+
class Result < Struct.new(:success, :message, :result_object)
|
3
|
+
def self.default_success(object = nil)
|
4
|
+
new(true, 'Completed successfully.', object)
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(*)
|
8
|
+
super
|
9
|
+
self.result_object ||= nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def success?
|
13
|
+
self.success
|
14
|
+
end
|
15
|
+
|
16
|
+
def failure?
|
17
|
+
!success?
|
18
|
+
end
|
19
|
+
|
20
|
+
def object
|
21
|
+
self.result_object
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/arbitrium/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arbitrium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lollar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,9 +52,10 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description: This gem was inspired by the overabundance of
|
56
|
-
in controllers
|
57
|
-
|
55
|
+
description: This gem was inspired by the overabundance of logic that I continually
|
56
|
+
saw in controllers in the Rails app I was working on. I've decided to implement
|
57
|
+
a straight ruby gem that has no dependencies on Rails. This gem will remain simple
|
58
|
+
in scope and will be modeled after the way that I like to write service object classes.
|
58
59
|
email:
|
59
60
|
- lollar.mchl@gmail.com
|
60
61
|
executables: []
|
@@ -71,6 +72,7 @@ files:
|
|
71
72
|
- bin/console
|
72
73
|
- bin/setup
|
73
74
|
- lib/arbitrium.rb
|
75
|
+
- lib/arbitrium/result.rb
|
74
76
|
- lib/arbitrium/version.rb
|
75
77
|
homepage: https://github.com/lollar/arbitrium
|
76
78
|
licenses: []
|