Module: BetterStorage::Patches::Blob

Defined in:
lib/better_storage/patches/blob.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject



15
16
17
18
# File 'lib/better_storage/patches/blob.rb', line 15

def delete
  service.delete(key)
  service.delete_prefixed(variant_prefix) if image?
end

#keyObject



4
5
6
7
8
9
# File 'lib/better_storage/patches/blob.rb', line 4

def key
  self[:key] ||= begin
    key = self.class.generate_unique_secure_token(length: self.class::MINIMUM_TOKEN_LENGTH)
    BetterStorage.generate_blob_key(key)
  end
end

#public_urlObject



11
12
13
# File 'lib/better_storage/patches/blob.rb', line 11

def public_url
  BetterStorage.public_url(key)
end

#variant_prefixObject



20
21
22
# File 'lib/better_storage/patches/blob.rb', line 20

def variant_prefix
  "#{key}/variants/"
end