Class: Uas2Git::LOReader
- Inherits:
-
Object
- Object
- Uas2Git::LOReader
- Defined in:
- lib/uas2git/lo_reader.rb
Instance Method Summary collapse
-
#initialize(connection) ⇒ LOReader
constructor
A new instance of LOReader.
- #open(stream, &block) ⇒ Object
- #read(size) ⇒ Object
Constructor Details
#initialize(connection) ⇒ LOReader
Returns a new instance of LOReader.
3 4 5 |
# File 'lib/uas2git/lo_reader.rb', line 3 def initialize(connection) @connection = connection end |
Instance Method Details
#open(stream, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/uas2git/lo_reader.rb', line 7 def open(stream, &block) @connection.transaction do begin @fd = @connection.lo_open(stream) r = yield self ensure @connection.lo_close(@fd) r end end end |
#read(size) ⇒ Object
22 23 24 |
# File 'lib/uas2git/lo_reader.rb', line 22 def read(size) @connection.lo_read(@fd, size) end |