Class: FeideeUtils::Kbf
- Inherits:
-
Object
- Object
- FeideeUtils::Kbf
- Defined in:
- lib/feidee_utils/kbf.rb
Constant Summary collapse
- DatabaseName =
'mymoney.sqlite'
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#zipfile ⇒ Object
readonly
Returns the value of attribute zipfile.
Class Method Summary collapse
Instance Method Summary collapse
- #extract_original_sqlite(dest_file_path = nil) ⇒ Object
-
#initialize(input_stream) ⇒ Kbf
constructor
A new instance of Kbf.
Constructor Details
#initialize(input_stream) ⇒ Kbf
Returns a new instance of Kbf.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/feidee_utils/kbf.rb', line 14 def initialize(input_stream) Zip::File.open_buffer(input_stream) do |zipfile| zipfile.each do |entry| if entry.name == DatabaseName # Each call to get_input_stream will create a new stream @original_sqlite_db_entry = entry @db = FeideeUtils::Database.new(entry.get_input_stream, true) end end end end |
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
12 13 14 |
# File 'lib/feidee_utils/kbf.rb', line 12 def db @db end |
#zipfile ⇒ Object (readonly)
Returns the value of attribute zipfile.
12 13 14 |
# File 'lib/feidee_utils/kbf.rb', line 12 def zipfile @zipfile end |
Class Method Details
Instance Method Details
#extract_original_sqlite(dest_file_path = nil) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/feidee_utils/kbf.rb', line 26 def extract_original_sqlite(dest_file_path = nil) FeideeUtils::Database.feidee_to_sqlite( @original_sqlite_db_entry.get_input_stream, dest_file_path ) end |