Class: Ole::Storage::AllocationTable::Big

### Home Classes Methods

### In Files

- lib/ole/storage/base.rb

### Parent

Ole::Storage::AllocationTable

### Methods

- ::new
- #blocks_to_ranges

### Files

- ChangeLog
- README

### Class/Module Index

Quicksearch

- Ole
- Ole::IOMode
- Ole::IOMode::Constants
- Ole::Storage
- Ole::Storage::AllocationTable
- Ole::Storage::AllocationTable::Big
- Ole::Storage::AllocationTable::Small
- Ole::Storage::DirClass
- Ole::Storage::DirClass::Dir
- Ole::Storage::Dirent
- Ole::Storage::FileClass
- Ole::Storage::FileClass::Stat
- Ole::Storage::Header
- Ole::Storage::MetaData
- Ole::Storage::RangesIOMigrateable
- Ole::Storage::RangesIOResizeable
- Ole::Types
- Ole::Types::Clsid
- Ole::Types::Data
- Ole::Types::FileTime
- Ole::Types::Lpstr
- Ole::Types::Lpwstr
- Ole::Types::PropertySet
- Ole::Types::PropertySet::Constants
- Ole::Types::PropertySet::Section
- Ole::Types::Variant
- Ole::Types::Variant::Constants
- RangesIO

No matching classes.

# Ole::Storage::AllocationTable::Big

### Public Class Methods

new(*args) click to toggle source

    # File lib/ole/storage/base.rb, line 565
    def initialize(*args)
      super
      @block_size = 1 << @ole.header.b_shift
      @io = @ole.io
    end

### Public Instance Methods

blocks_to_ranges(chain, size=nil) click to toggle source

Big blocks are kind of -1 based, in order to not clash with the header.

    # File lib/ole/storage/base.rb, line 572
    def blocks_to_ranges chain, size=nil
      #super chain.map { |b| b + 1 }, size
      # duplicated from AllocationTable#blocks_to_ranges to avoid chain.map
      # which was decent part of benchmark profile
      chain = chain[0, (size.to_f / block_size).ceil] if size
      ranges = chain.map { |i| [block_size * (i + 1), block_size] }
      ranges.last[1] -= (ranges.length * block_size - size) if ranges.last and size
      ranges
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.