lib/bindata/offset.rb
# To be called from BinData::Base#initialize.
#
# Monkey patches #do_read to check or adjust the stream offset
# as appropriate.
To be called from BinData::Base#initialize.
Monkey patches #do_read to check or adjust the stream offset
as appropriate.
To be called from BinData :: Base#initialize . Monkey patches #do_read to check or adjust the stream offset as appropriate .
def add_methods_for_check_or_adjust_offset
      if has_parameter?(:check_offset)
        class << self
          alias_method :do_read_without_check_offset, :do_read
          alias_method :do_read, :do_read_with_check_offset
        end
      end
      if has_parameter?(:adjust_offset)
        class << self
          alias_method :do_read_without_adjust_offset, :do_read
          alias_method :do_read, :do_read_with_adjust_offset
        end
      end
    end
def add_methods_for_check_or_adjust_offset if has_parameter? ( :check_offset ) class << self alias_method :do_read_without_check_offset , :do_read alias_method :do_read , :do_read_with_check_offset end end if has_parameter? ( :adjust_offset ) class << self alias_method :do_read_without_adjust_offset , :do_read alias_method :do_read , :do_read_with_adjust_offset end end end
To be called from BinData::Base#initialize.
To be called from BinData :: Base#initialize .