lib/bindata/delayed_io.rb in bindata-2.4.15 vs lib/bindata/delayed_io.rb in bindata-2.5.0
- old
+ new
@@ -81,15 +81,15 @@
def num_bytes
@type.num_bytes
end
- def respond_to?(symbol, include_private = false) #:nodoc:
- @type.respond_to?(symbol, include_private) || super
+ def respond_to_missing?(symbol, include_all = false) # :nodoc:
+ @type.respond_to?(symbol, include_all) || super
end
- def method_missing(symbol, *args, &block) #:nodoc:
+ def method_missing(symbol, *args, &block) # :nodoc:
@type.__send__(symbol, *args, &block)
end
def abs_offset
@abs_offset || eval_parameter(:read_abs_offset)
@@ -102,33 +102,33 @@
def rel_offset
abs_offset
end
- def do_read(io) #:nodoc:
+ def do_read(io) # :nodoc:
@read_io = io
end
- def do_write(io) #:nodoc:
+ def do_write(io) # :nodoc:
@write_io = io
end
- def do_num_bytes #:nodoc:
+ def do_num_bytes # :nodoc:
0
end
def include_obj?
- ! has_parameter?(:onlyif) || eval_parameter(:onlyif)
+ !has_parameter?(:onlyif) || eval_parameter(:onlyif)
end
# DelayedIO objects aren't read when #read is called.
# The reading is delayed until this method is called.
def read_now!
return unless include_obj?
raise IOError, "read from where?" unless @read_io
- @read_io.seekbytes(abs_offset - @read_io.offset)
+ @read_io.seek_to_abs_offset(abs_offset)
start_read do
@type.do_read(@read_io)
end
end
@@ -136,11 +136,11 @@
# The writing is delayed until this method is called.
def write_now!
return unless include_obj?
raise IOError, "write to where?" unless @write_io
- @write_io.seekbytes(abs_offset - @write_io.offset)
+ @write_io.seek_to_abs_offset(abs_offset)
@type.do_write(@write_io)
end
end
class DelayedIoArgProcessor < BaseArgProcessor
@@ -151,11 +151,11 @@
params.must_be_integer(:read_abs_offset)
params.sanitize_object_prototype(:type)
end
end
- # Add +auto_call_delayed_io+ keyword to BinData::Base.
class Base
+ # Add +auto_call_delayed_io+ keyword to BinData::Base.
class << self
# The +auto_call_delayed_io+ keyword sets a data object tree to perform
# multi pass I/O automatically.
def auto_call_delayed_io
include AutoCallDelayedIO