operatic 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +4 -2
- data/lib/operatic/result.rb +3 -3
- data/lib/operatic/version.rb +1 -1
- data/lib/operatic.rb +3 -3
- data/operatic.gemspec +8 -8
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d2d761cb5faa5c2c3033b701c7a716390cdefba8ebf2c13bbd20086375c81ff
|
4
|
+
data.tar.gz: 854bfdfc81e9c54866dc70f1c8773d11a664648e20d3bb33bab2a5fd4ca093fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd7219716eaf92d39c26a9bd7072a90eb45a3d95c86fc784c2c94de6645b4bd1c3b7dc8fb7d802fafd59db93532b96cb3ee4f5a93cd1e4a30973146244fd165e
|
7
|
+
data.tar.gz: 139a4f9bf2cddaec695fed7095b6460aa2b3cf5433980e327a05fa0ebeddedab7d53df934c07fe5c835eb57f935d2c5153fdc5e6c3cdd2bd5a22e630c86097a9
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
[![GitHub Actions status](https://github.com/benpickles/operatic/workflows/Ruby/badge.svg)](https://github.com/benpickles/operatic)
|
4
4
|
|
5
|
+
A minimal standard interface for your operations.
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add Operatic to your application's Gemfile and run `bundle install`.
|
@@ -36,13 +38,13 @@ end
|
|
36
38
|
result = SayHello.call(name: 'Dave')
|
37
39
|
result.success? # => true
|
38
40
|
result.message # => "Hello Dave"
|
39
|
-
result.
|
41
|
+
result.to_h # => {:message=>"Hello Dave"}
|
40
42
|
|
41
43
|
result = SayHello.call
|
42
44
|
result.failure? # => true
|
43
45
|
result.success? # => false
|
44
46
|
result.message # => nil
|
45
|
-
result.
|
47
|
+
result.to_h # => {}
|
46
48
|
```
|
47
49
|
|
48
50
|
A Rails controller might use Operatic like this:
|
data/lib/operatic/result.rb
CHANGED
@@ -69,11 +69,11 @@ module Operatic
|
|
69
69
|
@success
|
70
70
|
end
|
71
71
|
|
72
|
-
# Returns the full hash of data attached to the result via
|
73
|
-
# {#failure!}, or convenience accessors added with {.generate}.
|
72
|
+
# Returns the full (frozen) hash of data attached to the result via
|
73
|
+
# {#success!}, {#failure!}, or convenience accessors added with {.generate}.
|
74
74
|
#
|
75
75
|
# @return [Hash]
|
76
|
-
def
|
76
|
+
def to_h
|
77
77
|
@data
|
78
78
|
end
|
79
79
|
|
data/lib/operatic/version.rb
CHANGED
data/lib/operatic.rb
CHANGED
@@ -17,7 +17,7 @@ module Operatic
|
|
17
17
|
# @param attrs [Hash<Symbol, anything>] an optional hash of key/values to
|
18
18
|
# to the result. The class must have corresponding +attr_reader+s
|
19
19
|
#
|
20
|
-
# @return a [Result]
|
20
|
+
# @return a [Result]
|
21
21
|
def call(attrs = nil)
|
22
22
|
new(attrs)
|
23
23
|
.tap(&:call)
|
@@ -95,12 +95,12 @@ module Operatic
|
|
95
95
|
#
|
96
96
|
# result = SayHello.call(name: 'Dave')
|
97
97
|
# result.success? # => true
|
98
|
-
# result.
|
98
|
+
# result.to_h # => {:message=>"Hello Dave"}
|
99
99
|
#
|
100
100
|
# result = SayHello.call
|
101
101
|
# result.failure? # => true
|
102
102
|
# result.success? # => false
|
103
|
-
# result.
|
103
|
+
# result.to_h # => {}
|
104
104
|
def call
|
105
105
|
end
|
106
106
|
|
data/operatic.gemspec
CHANGED
@@ -8,22 +8,22 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Ben Pickles']
|
9
9
|
spec.email = ['spideryoung@gmail.com']
|
10
10
|
|
11
|
-
spec.summary = '
|
12
|
-
spec.description =
|
11
|
+
spec.summary = 'A minimal standard interface for your operations'
|
12
|
+
spec.description = spec.summary
|
13
13
|
spec.homepage = 'https://github.com/benpickles/operatic'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
spec.metadata = {
|
17
|
+
'changelog_uri' => 'https://github.com/benpickles/operatic/blob/master/CHANGELOG.md',
|
18
|
+
'documentation_uri' => 'https://rubydoc.info/gems/operatic',
|
19
|
+
'source_code_uri' => 'https://github.com/benpickles/operatic',
|
20
|
+
}
|
21
21
|
|
22
22
|
spec.required_ruby_version = '>= 2.5.0'
|
23
23
|
|
24
24
|
# Specify which files should be added to the gem when it is released.
|
25
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
|
-
spec.files = Dir.chdir(
|
26
|
+
spec.files = Dir.chdir(__dir__) do
|
27
27
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
28
28
|
end
|
29
29
|
spec.bindir = 'exe'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: operatic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Pickles
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description:
|
55
|
+
description: A minimal standard interface for your operations
|
56
56
|
email:
|
57
57
|
- spideryoung@gmail.com
|
58
58
|
executables: []
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- ".github/workflows/ruby.yml"
|
63
63
|
- ".gitignore"
|
64
64
|
- ".rspec"
|
65
|
+
- CHANGELOG.md
|
65
66
|
- CODE_OF_CONDUCT.md
|
66
67
|
- Gemfile
|
67
68
|
- LICENSE.txt
|
@@ -78,7 +79,9 @@ homepage: https://github.com/benpickles/operatic
|
|
78
79
|
licenses:
|
79
80
|
- MIT
|
80
81
|
metadata:
|
81
|
-
|
82
|
+
changelog_uri: https://github.com/benpickles/operatic/blob/master/CHANGELOG.md
|
83
|
+
documentation_uri: https://rubydoc.info/gems/operatic
|
84
|
+
source_code_uri: https://github.com/benpickles/operatic
|
82
85
|
post_install_message:
|
83
86
|
rdoc_options: []
|
84
87
|
require_paths:
|
@@ -97,5 +100,5 @@ requirements: []
|
|
97
100
|
rubygems_version: 3.0.3
|
98
101
|
signing_key:
|
99
102
|
specification_version: 4
|
100
|
-
summary:
|
103
|
+
summary: A minimal standard interface for your operations
|
101
104
|
test_files: []
|