This module is used to keep track of offsets in modified Excel documents. Considered internal and subject to change without notice.
# 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
# File lib/spreadsheet/excel/offset.rb, line 11 def initialize *args super @changes = {} @offsets = {} end
# 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
Generated with the Darkfish Rdoc Generator 2.