Class: ActiveStorage::Attached::Changes::PurgeOne

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, record, attachment) ⇒ PurgeOne

Returns a new instance of PurgeOne.



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

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

Instance Attribute Details

#attachmentObject (readonly)

Returns the value of attribute attachment.



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

def attachment
  @attachment
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#recordObject (readonly)

Returns the value of attribute record.



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

def record
  @record
end

Instance Method Details

#purgeObject



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

def purge
  attachment&.purge
  reset
end

#purge_laterObject



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

def purge_later
  attachment&.purge_later
  reset
end