Class: ActiveStorage::Attached::Changes::PurgeMany

Inherits:
Object
  • Object
show all
Defined in:
activestorage/lib/active_storage/attached/changes/purge_many.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, record, attachments) ⇒ PurgeMany

Returns a new instance of PurgeMany.



7
8
9
# File 'activestorage/lib/active_storage/attached/changes/purge_many.rb', line 7

def initialize(name, record, attachments)
  @name, @record, @attachments = name, record, attachments
end

Instance Attribute Details

#attachmentsObject (readonly)

Returns the value of attribute attachments



5
6
7
# File 'activestorage/lib/active_storage/attached/changes/purge_many.rb', line 5

def attachments
  @attachments
end

#nameObject (readonly)

Returns the value of attribute name



5
6
7
# File 'activestorage/lib/active_storage/attached/changes/purge_many.rb', line 5

def name
  @name
end

#recordObject (readonly)

Returns the value of attribute record



5
6
7
# File 'activestorage/lib/active_storage/attached/changes/purge_many.rb', line 5

def record
  @record
end

Instance Method Details

#purgeObject



11
12
13
14
# File 'activestorage/lib/active_storage/attached/changes/purge_many.rb', line 11

def purge
  attachments.each(&:purge)
  reset
end

#purge_laterObject



16
17
18
19
# File 'activestorage/lib/active_storage/attached/changes/purge_many.rb', line 16

def purge_later
  attachments.each(&:purge_later)
  reset
end