Class: DBF::Memo::Base
- Inherits:
-
Object
- Object
- DBF::Memo::Base
- Defined in:
- lib/dbf/memo/base.rb
Constant Summary collapse
- BLOCK_HEADER_SIZE =
8
- BLOCK_SIZE =
512
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
- #get(start_block) ⇒ Object
-
#initialize(data, version) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(data, version) ⇒ Base
Returns a new instance of Base.
11 12 13 14 |
# File 'lib/dbf/memo/base.rb', line 11 def initialize(data, version) @data = data @version = version end |
Class Method Details
.open(filename, version) ⇒ Object
7 8 9 |
# File 'lib/dbf/memo/base.rb', line 7 def self.open(filename, version) new(File.open(filename, 'rb'), version) end |
Instance Method Details
#close ⇒ Object
22 23 24 |
# File 'lib/dbf/memo/base.rb', line 22 def close @data.close && @data.closed? end |
#closed? ⇒ Boolean
26 27 28 |
# File 'lib/dbf/memo/base.rb', line 26 def closed? @data.closed? end |
#get(start_block) ⇒ Object
16 17 18 19 20 |
# File 'lib/dbf/memo/base.rb', line 16 def get(start_block) return nil unless start_block > 0 build_memo start_block end |