Sha256: 55456ba3474d50434d2769c29785e86e512cb772eff9c87e2263bb7d55af7fc6

Contents?: true

Size: 1013 Bytes

Versions: 15

Compression:

Stored size: 1013 Bytes

Contents

module Spreadsheet
  module Excel
##
# This module is used to keep track of offsets in modified Excel documents.
# Considered internal and subject to change without notice.
module Offset
  def initialize *args
    super
    @changes = {}
    @offsets = {}
  end
  def Offset.append_features mod
    super
    attr_reader :changes, :offsets
    mod.module_eval do
      class << self
        def offset *keys
          keys.each do |key|
            attr_reader key unless instance_methods.include? key.to_s
            define_method "#{key}=" do |value|
              @changes.store key, true
              instance_variable_set "@#{key}", value
            end
            define_method "set_#{key}" do |value, pos, len|
              instance_variable_set "@#{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
end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
spreadsheet-0.6.1.1 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.1.3 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.0 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.1.2 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.1.4 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.3 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.1.5 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.1.6 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.2.1 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.1 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.1.7 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.2 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.1.8 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.1.9 lib/spreadsheet/excel/offset.rb
spreadsheet-0.6.3.1 lib/spreadsheet/excel/offset.rb