Class: MiniMime::Db::PReadFile
- Inherits:
-
Object
- Object
- MiniMime::Db::PReadFile
- Defined in:
- lib/mini_mime.rb
Overview
For Windows support
Instance Method Summary collapse
-
#initialize(filename) ⇒ PReadFile
constructor
A new instance of PReadFile.
- #pread(size, offset) ⇒ Object
- #readline(*args) ⇒ Object
Constructor Details
#initialize(filename) ⇒ PReadFile
Returns a new instance of PReadFile.
93 94 95 96 97 98 99 |
# File 'lib/mini_mime.rb', line 93 def initialize(filename) @mutex = Mutex.new # We must open the file in binary mode # otherwise Ruby's automatic line terminator # translation will skew the row size @file = ::File.open(filename, 'rb') end |
Instance Method Details
#pread(size, offset) ⇒ Object
105 106 107 108 109 110 |
# File 'lib/mini_mime.rb', line 105 def pread(size, offset) @mutex.synchronize do @file.seek(offset, IO::SEEK_SET) @file.read(size) end end |
#readline(*args) ⇒ Object
101 102 103 |
# File 'lib/mini_mime.rb', line 101 def readline(*args) @file.readline(*args) end |