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
-
#sqlite_db ⇒ Object
readonly
Returns the value of attribute sqlite_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) @zipfile = 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 @sqlite_db = FeideeUtils::Database.new(entry.get_input_stream, true) end end end end |
Instance Attribute Details
#sqlite_db ⇒ Object (readonly)
Returns the value of attribute sqlite_db.
12 13 14 |
# File 'lib/feidee_utils/kbf.rb', line 12 def sqlite_db @sqlite_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
.open_file(file_name) ⇒ Object
31 32 33 |
# File 'lib/feidee_utils/kbf.rb', line 31 def open_file(file_name) return Kbf.new(File.open(file_name)) end |
Instance Method Details
#extract_original_sqlite(dest_file_path = nil) ⇒ Object
26 27 28 |
# 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 |