Skip to content

Commit

Permalink
Ensure #each is called on an Array for Ruby 1.9
Browse files Browse the repository at this point in the history
String#each does not exist in Ruby 1.9 and Rack requires the
body object respond to #each
  • Loading branch information
Eric Wong authored and lifo committed Jan 9, 2010
1 parent 0485fe0 commit cd3582f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cramp/controller/body.rb
Expand Up @@ -30,7 +30,7 @@ def flush
return unless @body_callback

until @queue.empty?
@queue.shift.each {|chunk| @body_callback.call(chunk) }
Array(@queue.shift).each {|chunk| @body_callback.call(chunk) }
end
end

Expand All @@ -40,7 +40,7 @@ def schedule_dequeue
EventMachine.next_tick do
next unless body = @queue.shift

body.each {|chunk| @body_callback.call(chunk) }
Array(body).each {|chunk| @body_callback.call(chunk) }
schedule_dequeue unless @queue.empty?
end
end
Expand Down

0 comments on commit cd3582f

Please sign in to comment.