annoy 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGES.txt +4 -0
  2. data/annoy.gemspec +1 -1
  3. data/lib/annoy.rb +6 -1
  4. metadata +2 -2
@@ -1,5 +1,9 @@
1
1
  ANNOY, CHANGES
2
2
 
3
+ #### 0.5.3 (2009-06-21) ###############################
4
+
5
+ * CHANGE: pose_question returns true when writer is nil
6
+
3
7
  #### 0.5.2 (2009-06-03) ###############################
4
8
 
5
9
  * FIXED: Bug in user get_user_input after timeout expires
@@ -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.2"
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"
@@ -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.2
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-03 00:00:00 -04:00
12
+ date: 2009-06-21 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency