exAspArk / batch-loader

:zap: Powerful tool for avoiding N+1 DB or HTTP queries
https://engineering.universe.com/batching-a-powerful-way-to-solve-n-1-queries-every-rubyist-should-know-24e20c6e7b94
MIT License
1.04k stars 52 forks source link

Support default batch value, with auto append #7

Closed bessey closed 7 years ago

bessey commented 7 years ago

Per discussion on #5. Makes this possible:

     lazy = BatchLoader.for(1).batch(default_value: [1]) do |nums, loader|
       nums.each { |num| loader.call(num, 123) }
     end
coveralls commented 7 years ago

Coverage Status

Changes Unknown when pulling ec944567db3b85110523a057869e8c51f9d598ec on bessey:array-syntax into on exAspArk:master.

bessey commented 7 years ago

Did the above on the now working callable branch, see #7