annoy 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +4 -0
- data/annoy.gemspec +1 -1
- data/lib/annoy.rb +6 -1
- metadata +2 -2
data/CHANGES.txt
CHANGED
data/annoy.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = "annoy"
|
3
3
|
s.rubyforge_project = "annoy"
|
4
|
-
s.version = "0.5.
|
4
|
+
s.version = "0.5.3"
|
5
5
|
s.summary = "Annoy: Like your annoying friend that asks you questions all the time."
|
6
6
|
s.description = s.summary
|
7
7
|
s.author = "Delano Mandelbaum"
|
data/lib/annoy.rb
CHANGED
@@ -176,12 +176,13 @@ class Annoy
|
|
176
176
|
# Prints a question to writer and waits for a response on STDIN.
|
177
177
|
# It checks whether STDIN is connected a tty so it doesn't block on gets.
|
178
178
|
# when there's no human around to annoy. It will return <b>TRUE</b> when
|
179
|
-
# STDIN is NOT connected to a tty.
|
179
|
+
# STDIN is NOT connected to a tty or if +writer+ is nil.
|
180
180
|
# * +msg+ The question to pose to the user
|
181
181
|
# * +regexp+ The regular expression to match the answer.
|
182
182
|
def Annoy.pose_question(msg, regexp, writer=STDOUT, period=nil)
|
183
183
|
return true unless STDIN.tty? # Only ask a question if there's a human
|
184
184
|
return true if Annoy.skip?
|
185
|
+
return true if writer.nil?
|
185
186
|
begin
|
186
187
|
success = Timeout::timeout(period || @@period) do
|
187
188
|
regexp &&= Regexp.new regexp
|
@@ -245,6 +246,10 @@ class Annoy
|
|
245
246
|
#writer.puts msg
|
246
247
|
return true
|
247
248
|
end
|
249
|
+
if writer.nil?
|
250
|
+
sleep period+1
|
251
|
+
return true
|
252
|
+
end
|
248
253
|
begin
|
249
254
|
period ||= @@period
|
250
255
|
success = Timeout::timeout(period) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: annoy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-21 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|