response_callback 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e77fadcef70c00675c39e280ee19b0c3d5a5e09d
4
- data.tar.gz: 681989c9be32ead064e1179fb30fb391663a28ed
3
+ metadata.gz: d54b7d4c5d1c10e20ad6fc8e4405c3dd95f0d523
4
+ data.tar.gz: 7347b3420f9ac34ca31c8cf2963bebaa08b44e5b
5
5
  SHA512:
6
- metadata.gz: 52754d12bb74da309af5b090d6aa5c597310486a71e21f73bd3f27976c684afd63787d131f8755b70f3b09ad8140b4b970bbd52afc69f3f783bbdf1d6ad093a1
7
- data.tar.gz: 9b9f5b264a747538cc3a38e002974032caf84fa0ff1038b21b360100683d1e1f691c893805b7dda8010da921c98e8beae550910eb7a5f6556a86bc94d8066d05
6
+ metadata.gz: 7ada5f91ea6a259b52a80f2f572b5e53e3c63905c6859bf44f345a3f7da3c9a55881d0eaeda8968761bedcdc2b0b2aa6876d784c7e15dfbb43f3334f558ce4d2
7
+ data.tar.gz: 2bbdc4e1943593153fd0c6d43fe811faeb73fc8a9d7c07c02f4742c85b9ef348bf437df5aa05dc342cce2c3bafe15e646b298ad1373dec7e72fc864fe3f92778
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # ResponseCallback
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/response_callback`. 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
+ Response callback for command query separation.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,45 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ It can be used with just the callbacks.
24
+
25
+ ```ruby
26
+ class AClass
27
+ def self.a_complex_operation
28
+ complex stuff
29
+ yield ResponseCallback::Success.new
30
+ rescue => e
31
+ yield ResponseCallback::Fail.new
32
+ end
33
+ end
34
+
35
+ AClass.a_complex_operation do |response|
36
+ response.on_success do
37
+ deal_with_success
38
+ end
39
+ response.on_fail do
40
+ deal_with_failure
41
+ end
42
+ end
43
+ ```
44
+
45
+ or you can return objects to the callbacks
46
+
47
+ ```ruby
48
+ class AClass
49
+ def self.a_complex_operation
50
+ complex stuff
51
+ yield ResponseCallback::Success.new(yield_var: awesome_object)
52
+ rescue => e
53
+ yield ResponseCallback::Fail.new(yield_var: error)
54
+ end
55
+ end
56
+
57
+ AClass.a_complex_operation do |response|
58
+ response.on_success { |awesome_object| awesome_object.message }
59
+ response.on_fail { |error| deal_with_failure }
60
+ end
61
+ ```
26
62
 
27
63
  ## Development
28
64
 
@@ -32,5 +68,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
68
 
33
69
  ## Contributing
34
70
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/response_callback. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
71
+ Bug reports and pull requests are welcome on GitHub at https://github.com/gabriel128/response_callback. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
72
+
73
+ ## License
36
74
 
75
+ This project is licenced under the MIT license, see [LICENSE](LICENSE) for details.
@@ -1,3 +1,3 @@
1
1
  module ResponseCallback
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: response_callback
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Torello
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-20 00:00:00.000000000 Z
11
+ date: 2015-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler