# File lib/ole/storage/base.rb, line 615
      def truncate size
        # note that old_blocks is != @ranges.length necessarily. i'm planning to write a
        # merge_ranges function that merges sequential ranges into one as an optimization.
        @bat.resize_chain @blocks, size
        @pos = size if @pos > size
        self.ranges = @bat.ranges(@blocks, size)
        self.first_block = @blocks.empty? ? AllocationTable::EOC : @blocks.first

        # don't know if this is required, but we explicitly request our @io to grow if necessary
        # we never shrink it though. maybe this belongs in allocationtable, where smarter decisions
        # can be made.
        # maybe its ok to just seek out there later??
        max = @ranges.map { |pos, len| pos + len }.max || 0
        @io.truncate max if max > @io.size
      end