Class: EacRailsRemotes::ImportFile

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_rails_remotes/import_file.rb

Defined Under Namespace

Classes: Counter

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ ImportFile

Returns a new instance of ImportFile.



5
6
7
# File 'lib/eac_rails_remotes/import_file.rb', line 5

def initialize(file)
  @file = file
end

Instance Method Details

#performObject



9
10
11
12
13
14
15
16
# File 'lib/eac_rails_remotes/import_file.rb', line 9

def perform
  @counter = Counter.new
  YAML.load_file(@file).each do |r|
    @counter.add_found(r[:source], r[:entity])
    ::EacRailsRemotes::Instance.import(r)
  end
  @counter.show_counts
end