Class: Kamome::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/kamome/loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ Loader



9
10
11
# File 'lib/kamome/loader.rb', line 9

def initialize(config:)
  @config = config
end

Instance Method Details

#call(operation:) {|model, lineno| ... } ⇒ Array

Returns csv digest.

Yields:

  • (model, lineno)

    Any logic you want to execute Don’t pass ‘-> { break }`, use `-> { throw :break }



17
18
19
20
21
22
# File 'lib/kamome/loader.rb', line 17

def call(operation:, &block)
  operation.urls.map do |url|
    csv_path = download(url)
    call_csv_handler(operation, csv_path, &block)
  end
end