Class: Sped2DB::Extractor

Inherits:
Object
  • Object
show all
Includes:
EventEmitter, Utils
Defined in:
lib/sped2db/extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#count_lines, #date_string?, #get_first_line, #get_first_line_fields, #get_layout, #sped_file?

Constructor Details

#initialize(sped_files, db, opts = {}) ⇒ Extractor

Returns a new instance of Extractor.



8
9
10
11
12
13
14
15
# File 'lib/sped2db/extractor.rb', line 8

def initialize(sped_files, db, opts = {})
  @sped_files = sped_files
  @db = db
  @continue_on_error = opts.fetch(:continue_on_error, false)
  @layout = get_layout(sped_files.first)
  @metadata = 
  @ids = {}
end

Instance Attribute Details

#layoutObject (readonly)

Returns the value of attribute layout.



6
7
8
# File 'lib/sped2db/extractor.rb', line 6

def layout
  @layout
end

Instance Method Details

#importObject



17
18
19
# File 'lib/sped2db/extractor.rb', line 17

def import
  @sped_files.each_with_index { |f, i| process_file(f, i) }
end