Class: PureCDB::SysIOWrapper
- Inherits:
-
Object
- Object
- PureCDB::SysIOWrapper
- Defined in:
- lib/purecdb/base.rb
Overview
Wrap an object that does not have all of sysseek/syswrite/sysread
but that does have seek/write/read
with similar semantics. This is primarily intended for use with StringIO
, which lacks syseek
It is automatically interjected on creating a PureCDB::Reader
or +PureCDB::Writer if the IO-like object that is passed lacks sysseek
so you should normally not need to think about this class
Instance Method Summary collapse
-
#initialize(target) ⇒ SysIOWrapper
constructor
A new instance of SysIOWrapper.
-
#sysread(size) ⇒ Object
Delegates to
read
. -
#sysseek(offset, mode) ⇒ Object
Delegates to
seek
. -
#syswrite(buffer) ⇒ Object
Delegates to
write
.
Constructor Details
#initialize(target) ⇒ SysIOWrapper
Returns a new instance of SysIOWrapper.
134 135 136 |
# File 'lib/purecdb/base.rb', line 134 def initialize target @target = target end |
Instance Method Details
#sysread(size) ⇒ Object
Delegates to read
144 145 146 |
# File 'lib/purecdb/base.rb', line 144 def sysread(size) @target.read(size) end |
#sysseek(offset, mode) ⇒ Object
Delegates to seek
139 140 141 |
# File 'lib/purecdb/base.rb', line 139 def sysseek(offset,mode) @target.seek(offset,mode) end |
#syswrite(buffer) ⇒ Object
Delegates to write
149 150 151 |
# File 'lib/purecdb/base.rb', line 149 def syswrite(buffer) @target.write(buffer) end |