outcome 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/LICENSE +20 -0
  4. data/README.md +69 -0
  5. metadata +89 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2593a37dfe72ad4289cd5b9fbaa2deee9d8597c0
4
+ data.tar.gz: 451a46c5fc3efe5a453ec954cb08fc973d3b1977
5
+ SHA512:
6
+ metadata.gz: fc495d6f38df0cfaf424ca808ed0e2d57a4d4a6b07815fd8ab14f5fc604698fd2d1c61619bfac5829c790270d90d1c61edfe6abd96e70bfbf07ca526810b0ba1
7
+ data.tar.gz: c4b68c86724c68e34c716a11b710d856047497e341902cf3fd84834009b2e2473121ad8515033f02f9f5be3ca475c59fa579a98484800774a94f09cc9f1c05a3
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Jo Hund
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,69 @@
1
+ Outcome
2
+ =======
3
+
4
+ This Ruby gem provides a standardized container for the outcome of a process.
5
+
6
+ It comes with [detailed documentation](http://rails-recipes.clearcove.ca/pages/outcome.html).
7
+
8
+
9
+ Installation
10
+ ------------
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'outcome'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install outcome
23
+
24
+
25
+ Usage
26
+ -----
27
+
28
+ Whenever you need to return more than a simple object as the outcome of a process,
29
+ you can use an instance of the Outcome class.
30
+
31
+ An outcome has the following attributes:
32
+
33
+ * success: Indicates if the process was successful (Bool)
34
+ * result: The return value of the process. Anything you want to return. (Object)
35
+ * messages: Any messages generated during the process. (Array of strings, optional)
36
+ * errors: Any errors generated during the process. (Array of strings, optional)
37
+ * warnings: Any warnings generated during the process. (Array of strings, optional)
38
+
39
+ Here is how you use it in your code:
40
+
41
+ ~~~~ ruby
42
+ def my_process
43
+ # process code ...
44
+ if successful
45
+ Outcome.new(true, [1,2,3], ['All went well'])
46
+ else
47
+ Outcome.new(false, nil, [], ['All went wrong while doing ...'])
48
+ end
49
+ end
50
+ ~~~~
51
+
52
+ This gives you a standardized process outcome interface. No rocket science,
53
+ just one less thing to re-invent.
54
+
55
+
56
+ License
57
+ -------
58
+
59
+ MIT (see LICENSE file).
60
+
61
+
62
+ Contributing
63
+ ------------
64
+
65
+ 1. Fork it ( http://github.com/<my-github-username>/outcome/fork )
66
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
67
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
68
+ 4. Push to the branch (`git push origin my-new-feature`)
69
+ 5. Create new Pull Request
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: outcome
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jo Hund
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest-spec-expect
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Outcome provides a standardized container for the outcome of a Ruby process.
56
+ email:
57
+ - jhund@clearcove.ca
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - LICENSE
64
+ - README.md
65
+ homepage: http://rails-recipes.clearcove.ca/pages/outcome.html
66
+ licenses:
67
+ - MIT
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.2.2
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Outcome provides a standardized container for the outcome of a Ruby process.
89
+ test_files: []