fire_poll 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -1
- data/Rakefile +1 -1
- data/lib/fire_poll.rb +3 -3
- data/lib/fire_poll/version.rb +1 -1
- data/test/test_fire_poll.rb +5 -0
- metadata +10 -30
data/.yardopts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--markup markdown --readme README.md
|
1
|
+
--markup markdown --readme README.md --hide-void-return
|
data/Rakefile
CHANGED
data/lib/fire_poll.rb
CHANGED
@@ -6,16 +6,16 @@ module FirePoll
|
|
6
6
|
# @yieldreturn false if polling should continue
|
7
7
|
# @yieldreturn true if polling is complete
|
8
8
|
# @raise [RuntimeError] when polling fails
|
9
|
-
# @return
|
9
|
+
# @return the return value of the passed block
|
10
10
|
# @since 1.0.0
|
11
11
|
def poll(msg=nil, seconds=2.0)
|
12
12
|
(seconds * 10).to_i.times do
|
13
|
-
|
13
|
+
result = yield
|
14
|
+
return result if result
|
14
15
|
sleep 0.1
|
15
16
|
end
|
16
17
|
msg ||= "polling failed after #{seconds} seconds"
|
17
18
|
raise msg
|
18
|
-
nil
|
19
19
|
end
|
20
20
|
|
21
21
|
module_function :poll
|
data/lib/fire_poll/version.rb
CHANGED
data/test/test_fire_poll.rb
CHANGED
@@ -54,6 +54,11 @@ class FirePollTest < Test::Unit::TestCase
|
|
54
54
|
end
|
55
55
|
flunk "should have raised"
|
56
56
|
end
|
57
|
+
|
58
|
+
def test_the_result_of_the_block_is_returned
|
59
|
+
result = FirePoll.poll { "this is the result of the block" }
|
60
|
+
assert_equal "this is the result of the block", result
|
61
|
+
end
|
57
62
|
end
|
58
63
|
|
59
64
|
class TestFirePollMixin < Test::Unit::TestCase
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fire_poll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
version: 1.0.0
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Matt Fletcher
|
@@ -16,68 +12,51 @@ autorequire:
|
|
16
12
|
bindir: bin
|
17
13
|
cert_chain: []
|
18
14
|
|
19
|
-
date: 2011-
|
20
|
-
default_executable:
|
15
|
+
date: 2011-12-16 00:00:00 Z
|
21
16
|
dependencies:
|
22
17
|
- !ruby/object:Gem::Dependency
|
23
18
|
name: bundler
|
24
|
-
prerelease: false
|
25
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
20
|
none: false
|
27
21
|
requirements:
|
28
22
|
- - ">="
|
29
23
|
- !ruby/object:Gem::Version
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 0
|
33
|
-
- 0
|
34
24
|
version: 1.0.0
|
35
25
|
type: :development
|
26
|
+
prerelease: false
|
36
27
|
version_requirements: *id001
|
37
28
|
- !ruby/object:Gem::Dependency
|
38
29
|
name: rake
|
39
|
-
prerelease: false
|
40
30
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
31
|
none: false
|
42
32
|
requirements:
|
43
33
|
- - ">="
|
44
34
|
- !ruby/object:Gem::Version
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 8
|
48
|
-
- 0
|
49
35
|
version: 0.8.0
|
50
36
|
type: :development
|
37
|
+
prerelease: false
|
51
38
|
version_requirements: *id002
|
52
39
|
- !ruby/object:Gem::Dependency
|
53
40
|
name: yard
|
54
|
-
prerelease: false
|
55
41
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
42
|
none: false
|
57
43
|
requirements:
|
58
44
|
- - ~>
|
59
45
|
- !ruby/object:Gem::Version
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
- 6
|
63
|
-
- 4
|
64
46
|
version: 0.6.4
|
65
47
|
type: :development
|
48
|
+
prerelease: false
|
66
49
|
version_requirements: *id003
|
67
50
|
- !ruby/object:Gem::Dependency
|
68
51
|
name: bluecloth
|
69
|
-
prerelease: false
|
70
52
|
requirement: &id004 !ruby/object:Gem::Requirement
|
71
53
|
none: false
|
72
54
|
requirements:
|
73
55
|
- - ~>
|
74
56
|
- !ruby/object:Gem::Version
|
75
|
-
segments:
|
76
|
-
- 2
|
77
|
-
- 0
|
78
|
-
- 11
|
79
57
|
version: 2.0.11
|
80
58
|
type: :development
|
59
|
+
prerelease: false
|
81
60
|
version_requirements: *id004
|
82
61
|
description: Simple, brute-force method for knowing when something is ready
|
83
62
|
email:
|
@@ -101,7 +80,6 @@ files:
|
|
101
80
|
- lib/fire_poll.rb
|
102
81
|
- lib/fire_poll/version.rb
|
103
82
|
- test/test_fire_poll.rb
|
104
|
-
has_rdoc: true
|
105
83
|
homepage: ""
|
106
84
|
licenses: []
|
107
85
|
|
@@ -115,6 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
93
|
requirements:
|
116
94
|
- - ">="
|
117
95
|
- !ruby/object:Gem::Version
|
96
|
+
hash: 1299515667354431829
|
118
97
|
segments:
|
119
98
|
- 0
|
120
99
|
version: "0"
|
@@ -123,13 +102,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
102
|
requirements:
|
124
103
|
- - ">="
|
125
104
|
- !ruby/object:Gem::Version
|
105
|
+
hash: 1299515667354431829
|
126
106
|
segments:
|
127
107
|
- 0
|
128
108
|
version: "0"
|
129
109
|
requirements: []
|
130
110
|
|
131
111
|
rubyforge_project: fire_poll
|
132
|
-
rubygems_version: 1.
|
112
|
+
rubygems_version: 1.8.10
|
133
113
|
signing_key:
|
134
114
|
specification_version: 3
|
135
115
|
summary: Simple, brute-force method for knowing when something is ready
|