Module: DataResurrection::Adapter::DBF
- Defined in:
- lib/data_resurrection/adapter/dbf.rb
Defined Under Namespace
Classes: ARObject
Instance Method Summary collapse
- #get_data(table, encodings = nil, reserved_words = [], replacement = {}) ⇒ Object
- #resurrect(origin_table, options) ⇒ Object
Instance Method Details
#get_data(table, encodings = nil, reserved_words = [], replacement = {}) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/data_resurrection/adapter/dbf.rb', line 20 def get_data(table, encodings=nil, reserved_words=[], replacement = {}) result = get_raw_data(table, reserved_words) result = handle_encodings(result, encodings) if encodings.present? result = apply_replacements(result, replacement) if replacement result end |
#resurrect(origin_table, options) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/data_resurrection/adapter/dbf.rb', line 9 def resurrect(origin_table, ) target_table_name = [:target] from, to = [:from], [:to] field_types = [:field_types] table = ::DBF::Table.new(origin_table) encodings = from.present? ? {from: from, to: to} : nil data = get_data(table, encodings, reserved_words, [:replacement]) create_table(table, target_table_name, data, field_types) copy_data(target_table_name, data) end |