Method: ActiveDataFrame::DataFrameProxy.iterate_bounds

Defined in:
lib/active_data_frame/data_frame_proxy.rb

.iterate_bounds(all_bounds, block_type) ⇒ Object



148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/active_data_frame/data_frame_proxy.rb', line 148

def self.iterate_bounds(all_bounds, block_type)
  cursor = 0
  all_bounds.each do |bounds|
    index = bounds.from.index
    while index <= bounds.to.index
      left  = index == bounds.from.index ? bounds.from.offset : 0
      right = index == bounds.to.index   ? bounds.to.offset   : block_type::BLOCK_SIZE - 1
      size  = (right - left)+1
      yield index, left, right, cursor, size
      cursor += size
      index += 1
    end
  end
end