# File lib/ole/storage/base.rb, line 487 def blocks_to_ranges chain, size=nil # truncate the chain if required chain = chain[0, (size.to_f / block_size).ceil] if size # convert chain to ranges of the block size ranges = chain.map { |i| [block_size * i, block_size] } # truncate final range if required ranges.last[1] -= (ranges.length * block_size - size) if ranges.last and size ranges end