Commit dee0ba1b0d793dcde6690ff7b3af822da51c18eb

Authored by Luke Baker
1 parent c3c5fb1d

abstract dependency on generator

app/controllers/questions_controller.rb
@@ -369,7 +369,7 @@ class QuestionsController < InheritedResources::Base @@ -369,7 +369,7 @@ class QuestionsController < InheritedResources::Base
369 # objects. This solution depends on Array#to_xml rendering each 369 # objects. This solution depends on Array#to_xml rendering each
370 # member in the correct order. Internally, it just uses, #each, so 370 # member in the correct order. Internally, it just uses, #each, so
371 # this _should_ work. 371 # this _should_ work.
372 - ids = Generator.new{ |g| @questions.each{ |q| g.yield q.id } } 372 + ids = Enumerator.new{ |g| @questions.each{ |q| g.yield q.id } }
373 extra_info = Proc.new do |o| 373 extra_info = Proc.new do |o|
374 id = ids.next 374 id = ids.next
375 counts.each_pair do |attr, hash| 375 counts.each_pair do |attr, hash|
lib/enumerator_bridge.rb 0 → 100644
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
  1 +unless defined? Enumerator
  2 + require 'generator'
  3 + Enumerator = Generator
  4 +end