Skip to content

Instantly share code, notes, and snippets.

@takeru
Created April 27, 2010 12:17
Show Gist options
  • Select an option

  • Save takeru/380676 to your computer and use it in GitHub Desktop.

Select an option

Save takeru/380676 to your computer and use it in GitHub Desktop.
def each(opts={}) #todo(tx=nil)
TinyDS::LowDS.retry_if_timeout do
index = 0
@q.each(opts.dup) do |entity| # <= HERE
if opts[:limit] && opts[:limit]<=index
TinyDS::Base.logger.warn "too_many_results: each limit=#{opts[:limit]} index=#{index}"
break
end
index += 1
yield(@model_class.new_from_entity(entity))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment