Module: BinData::Base::AutoCallDelayedIO

Defined in:
lib/bindata/delayed_io.rb

Instance Method Summary collapse

Instance Method Details

#initialize_shared_instanceObject



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

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

#num_bytesObject



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

def num_bytes
  to_binary_s.size
end

#read(io) ⇒ Object



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

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

#write(io, *_) ⇒ Object



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

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