call 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/call.gemspec +1 -1
- data/lib/call/response.rb +3 -1
- data/lib/call/version.rb +1 -1
- data/spec/call_spec.rb +7 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ad2822a1b06af2df2e30453263b1310dfb99ce7
|
4
|
+
data.tar.gz: 640355175d7335585ea19757ff7dc726708baf00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4756a2afa9431609d96d6e11bf72349c339d20cdff0d9acee8e04cb741260279b00ac014c8a5b390617cd5190f60492e7cc0f01675e52c52056a01ae089507bc
|
7
|
+
data.tar.gz: 591246de784d0afe82661dc42ee5a43aae500beeaa256a6d74445e03184f4868b0bae59f90c56864366d0e51c4332e0ba1bc58456c686aeba212beddc5b4b710
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Call
|
2
2
|
|
3
|
-
|
3
|
+
We use this little gem for coordination the Callback-Trigger-Pingpong between
|
4
|
+
contexts and their callers.
|
5
|
+
|
6
|
+
See [examples/dci.rb](https://github.com/neopoly/call/blob/master/examples/dci.rb) for a running piece of code using `Call`.
|
7
|
+
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -16,10 +20,6 @@ Or install it yourself as:
|
|
16
20
|
|
17
21
|
$ gem install call
|
18
22
|
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
23
|
## Contributing
|
24
24
|
|
25
25
|
1. Fork it
|
data/call.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'call/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "call"
|
8
8
|
spec.version = Call::VERSION
|
9
|
-
spec.authors = ["Jakob Holderbaum"]
|
9
|
+
spec.authors = ["Jakob Holderbaum", "Peter Suschlik", "Jonas Thiel"]
|
10
10
|
spec.email = ["jh@neopoly.de"]
|
11
11
|
spec.summary = %q{Callback-Trigger-Pingpong for clean DCI implementation.}
|
12
12
|
spec.homepage = "https://github.com/neopoly/call"
|
data/lib/call/response.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Call
|
2
2
|
class Response
|
3
|
+
attr_reader :type, :args
|
4
|
+
|
3
5
|
def initialize(type, *args)
|
4
6
|
@type = type
|
5
7
|
@args = args
|
@@ -7,7 +9,7 @@ module Call
|
|
7
9
|
|
8
10
|
private
|
9
11
|
def trigger_responded(type, &block)
|
10
|
-
if type ==
|
12
|
+
if type == self.type
|
11
13
|
block.call(*@args)
|
12
14
|
end
|
13
15
|
end
|
data/lib/call/version.rb
CHANGED
data/spec/call_spec.rb
CHANGED
@@ -38,7 +38,7 @@ describe Call do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
on.failure do |*args|
|
41
|
-
@calls << OpenStruct.new(:type => :
|
41
|
+
@calls << OpenStruct.new(:type => :failure, :args => args)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -46,5 +46,11 @@ describe Call do
|
|
46
46
|
trigger.failure 22
|
47
47
|
|
48
48
|
assert_equal 2, @calls.size
|
49
|
+
|
50
|
+
assert_equal :success, @calls[0].type
|
51
|
+
assert_equal ['12', :b], @calls[0].args
|
52
|
+
|
53
|
+
assert_equal :failure, @calls[1].type
|
54
|
+
assert_equal [22], @calls[1].args
|
49
55
|
end
|
50
56
|
end
|
metadata
CHANGED