callbacks_attachable 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/callbacks_attachable.gemspec +3 -0
- data/lib/callbacks_attachable.rb +5 -3
- data/lib/callbacks_attachable/version.rb +1 -1
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e78e27472315f5970a2d932563206b0b9705487f
|
4
|
+
data.tar.gz: e97e711ecbfdd3c9162f01d258e60569dec76c73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffff535941e3de5c9cf0dc6244930ba2ccadbde442d521559b3aa4afb3c7c13cfdca9796984d0b6f1b6f419b60b3f79d82e32c9887d83e6538eeb58eaf744052
|
7
|
+
data.tar.gz: afd9d3b9752ca359f9175279ef6c7e8afba2567efe4938a058483b2ae4956f00a6fdc2b2ba70cce1aae8d58b20864ba97400192cd2ffa6b9f76a40ac035edd79
|
@@ -19,4 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.8"
|
21
21
|
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
23
|
+
spec.add_development_dependency "rspec-its"
|
24
|
+
spec.add_development_dependency "rspec-mocks-matchers-send_message", "~> 0.3"
|
22
25
|
end
|
data/lib/callbacks_attachable.rb
CHANGED
@@ -27,7 +27,9 @@ module CallbacksAttachable
|
|
27
27
|
def until_true_on(event, *opts, &callback)
|
28
28
|
klass = self
|
29
29
|
registered_callback = on(event, *opts) do |*args|
|
30
|
-
|
30
|
+
instance_exec(*args, &callback).tap do |result|
|
31
|
+
klass.off(event, registered_callback) if result
|
32
|
+
end
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
@@ -36,9 +38,9 @@ module CallbacksAttachable
|
|
36
38
|
|
37
39
|
# dup the callback list so that removing callbacks while iterating does
|
38
40
|
# still call all callbacks during map.
|
39
|
-
callbacks[event].dup.
|
41
|
+
callbacks[event].dup.all? do |callback|
|
40
42
|
context.instance_exec(*args, &callback) != false
|
41
|
-
end
|
43
|
+
end
|
42
44
|
end
|
43
45
|
|
44
46
|
def off(event, callback)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: callbacks_attachable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Aue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,48 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.4'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-its
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-mocks-matchers-send_message
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.3'
|
41
83
|
description:
|
42
84
|
email:
|
43
85
|
- mail@christopheraue.net
|