Class: EacRailsRemotes::ImportFile::Counter
- Inherits:
-
Object
- Object
- EacRailsRemotes::ImportFile::Counter
- Defined in:
- lib/eac_rails_remotes/import_file.rb
Instance Method Summary collapse
- #add_found(source, entity) ⇒ Object
-
#initialize ⇒ Counter
constructor
A new instance of Counter.
- #show_counts ⇒ Object
Constructor Details
#initialize ⇒ Counter
Returns a new instance of Counter.
26 27 28 29 |
# File 'lib/eac_rails_remotes/import_file.rb', line 26 def initialize @initial_counts = current_counts @counts = ActiveSupport::HashWithIndifferentAccess.new end |
Instance Method Details
#add_found(source, entity) ⇒ Object
31 32 33 34 |
# File 'lib/eac_rails_remotes/import_file.rb', line 31 def add_found(source, entity) @counts[entity_to_s(source, entity)] ||= 0 @counts[entity_to_s(source, entity)] += 1 end |
#show_counts ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/eac_rails_remotes/import_file.rb', line 36 def show_counts Rails.logger.info('Counts') counts_to_show.each do |l, es| Rails.logger.info(" * #{l}:") es.each do |e, c| Rails.logger.info(" * #{e}: #{c}") end end end |