Module: Spreadsheet::Excel::Offset

### Home Classes Methods

### In Files

- lib/spreadsheet/excel/offset.rb

### Methods

- ::append_features
- ::new
- ::offset

### Included Modules

- Spreadsheet::Compatibility
- Spreadsheet::Compatibility

### Files

- LICENSE.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Spreadsheet
- Spreadsheet::Column
- Spreadsheet::Compatibility
- Spreadsheet::Datatypes
- Spreadsheet::Encodings
- Spreadsheet::Errors
- Spreadsheet::Excel
- Spreadsheet::Excel::Error
- Spreadsheet::Excel::ExcelCompatibleWorkbook
- Spreadsheet::Excel::Internals
- Spreadsheet::Excel::Internals::Biff5
- Spreadsheet::Excel::Internals::Biff8
- Spreadsheet::Excel::Offset
- Spreadsheet::Excel::Password
- Spreadsheet::Excel::Reader
- Spreadsheet::Excel::Reader::Biff5
- Spreadsheet::Excel::Rgb
- Spreadsheet::Excel::Row
- Spreadsheet::Excel::SstEntry
- Spreadsheet::Excel::Workbook
- Spreadsheet::Excel::Worksheet
- Spreadsheet::Font
- Spreadsheet::Format
- Spreadsheet::Formula
- Spreadsheet::Helpers
- Spreadsheet::Link
- Spreadsheet::Note
- Spreadsheet::NoteObject
- Spreadsheet::ParseExcel
- Spreadsheet::ParseExcel::Worksheet
- Spreadsheet::ParseExcel::Worksheet::Cell
- Spreadsheet::Row
- Spreadsheet::Workbook
- Spreadsheet::Worksheet
- Spreadsheet::Writer

No matching classes.

# Spreadsheet::Excel::Offset

This module is used to keep track of offsets in modified Excel documents. Considered internal and subject to change without notice.

### Attributes

changes[R]
offsets[R]

### Public Class Methods

append_features(mod) click to toggle source

    # File lib/spreadsheet/excel/offset.rb, line 16
    def Offset.append_features mod
      super
      mod.module_eval do
        class << self
          include Compatibility
          def offset *keys
            keys.each do |key|
              attr_reader key unless instance_methods.include? method_name(key)
              define_method "#{key}=" do |value|
                @changes.store key, true
                instance_variable_set ivar_name(key), value
              end
              define_method "set_#{key}" do |value, pos, len|
                instance_variable_set ivar_name(key), value
                @offsets.store key, [pos, len]
                havename = "have_set_#{key}"
                send(havename, value, pos, len) if respond_to? havename
              end
            end
          end
        end
      end
    end

new(*args) click to toggle source

    # File lib/spreadsheet/excel/offset.rb, line 11
    def initialize *args
      super
      @changes = {}
      @offsets = {}
    end

offset(*keys) click to toggle source

    # File lib/spreadsheet/excel/offset.rb, line 21
    def offset *keys
      keys.each do |key|
        attr_reader key unless instance_methods.include? method_name(key)
        define_method "#{key}=" do |value|
          @changes.store key, true
          instance_variable_set ivar_name(key), value
        end
        define_method "set_#{key}" do |value, pos, len|
          instance_variable_set ivar_name(key), value
          @offsets.store key, [pos, len]
          havename = "have_set_#{key}"
          send(havename, value, pos, len) if respond_to? havename
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.