Skip to content

Commit cd3582f

Browse files
Eric Wonglifo
authored andcommitted
Ensure #each is called on an Array for Ruby 1.9
String#each does not exist in Ruby 1.9 and Rack requires the body object respond to #each
1 parent 0485fe0 commit cd3582f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/cramp/controller/body.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def flush
3030
return unless @body_callback
3131

3232
until @queue.empty?
33-
@queue.shift.each {|chunk| @body_callback.call(chunk) }
33+
Array(@queue.shift).each {|chunk| @body_callback.call(chunk) }
3434
end
3535
end
3636

@@ -40,7 +40,7 @@ def schedule_dequeue
4040
EventMachine.next_tick do
4141
next unless body = @queue.shift
4242

43-
body.each {|chunk| @body_callback.call(chunk) }
43+
Array(body).each {|chunk| @body_callback.call(chunk) }
4444
schedule_dequeue unless @queue.empty?
4545
end
4646
end

0 commit comments

Comments
 (0)