mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 20:27:30 +02:00
20 lines
432 B
Ruby
20 lines
432 B
Ruby
class InactiveContacts
|
|
attr_reader :contacts
|
|
|
|
def initialize(contacts = Contact.archivable)
|
|
@contacts = contacts
|
|
end
|
|
|
|
def archive(verified: false)
|
|
contacts.each do |contact|
|
|
log("Archiving contact: id(#{contact.id}), code(#{contact.code})")
|
|
contact.archive(verified: verified)
|
|
yield contact if block_given?
|
|
end
|
|
end
|
|
|
|
def log(msg)
|
|
@log ||= Logger.new(STDOUT)
|
|
@log.info(msg)
|
|
end
|
|
end
|