arbitrium 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5c26f1e1fb14840f4600a4c8014ee21361a564f
4
- data.tar.gz: 220db856ecccc251922115b612f8b87d556938bc
3
+ metadata.gz: ecc167d7ea5fe60069c5683338656ca849f2d892
4
+ data.tar.gz: bb5247460df31fa4ae2cad97ec69e21c63267cb0
5
5
  SHA512:
6
- metadata.gz: 15ca19af558a35dbfd75538123ebc97c23a878209e536aa75b7255d3f797d60d0d34b5ce8d21da89adafbed165ea16273813a67d609d491a94d122dbb2c34694
7
- data.tar.gz: 9290c8c41c329856d3af576b0ff2776fb27e3b68de2ac96d468010fa48ce613bf4abed41572d83340a09f8754b1ebc8b48a96d96e6a1b5f9a9c77a368f51ed6d
6
+ metadata.gz: d5562d12eef0fafc7b604f9524cc6b46d7d3f31b3ecf79d9deb68b00c2198c8a896fe80293bd1a5022670eaf1c5ef016bd8d3846f8d95cb46e20fb53f86e53e5
7
+ data.tar.gz: 3f766bb40d7fe3debf1f3244f1b8abff4b27bd0a0390c44ea2d4bbe7c2acfdc0a6748447d8562686d82345d84a0aafd219c0465b61eccb4b99b0f6ce1abb126a
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ arbitrium-0.1.0.gem
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Arbitrium
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/arbitrium`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Write usage instructions here
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
-
@@ -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 business logic that is in controllers. This gem will remain simple in scope and will be modeled after the way that I like to write service object classes.}
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|
@@ -1,4 +1,5 @@
1
- require "arbitrium/version"
1
+ require 'arbitrium/version'
2
+ require 'arbitrium/result'
2
3
 
3
4
  module Arbitrium
4
5
  # Your code goes here...
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Arbitrium
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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-24 00:00:00.000000000 Z
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 business logic that is
56
- in controllers. This gem will remain simple in scope and will be modeled after
57
- the way that I like to write service object classes.
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: []