Module: BinData::Base::AutoCallDelayedIO

Defined in:
lib/bindata/delayed_io.rb

Instance Method Summary collapse

Instance Method Details

#initialize_shared_instanceObject



180
181
182
183
# File 'lib/bindata/delayed_io.rb', line 180

def initialize_shared_instance
  top_level_set(:delayed_ios, [])
  super
end

#num_bytesObject



193
194
195
# File 'lib/bindata/delayed_io.rb', line 193

def num_bytes
  to_binary_s.size
end

#read(io) ⇒ Object



185
186
187
# File 'lib/bindata/delayed_io.rb', line 185

def read(io)
  super(io) { top_level_get(:delayed_ios).each(&:read_now!) }
end

#write(io, *_) ⇒ Object



189
190
191
# File 'lib/bindata/delayed_io.rb', line 189

def write(io, *_)
  super(io) { top_level_get(:delayed_ios).each(&:write_now!) }
end