Class: Tessa::ActiveStorage::AssetWrapper

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/tessa/active_storage/asset_wrapper.rb

Instance Method Summary collapse

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/tessa/active_storage/asset_wrapper.rb', line 27

def failure?
  false
end

#idObject



3
4
5
# File 'lib/tessa/active_storage/asset_wrapper.rb', line 3

def id
  key
end

#metaObject



20
21
22
23
24
25
# File 'lib/tessa/active_storage/asset_wrapper.rb', line 20

def meta
  {
    mime_type: content_type,
    size: byte_size
  }
end

#private_download_url(expires_in: 1.day) ⇒ Object



16
17
18
# File 'lib/tessa/active_storage/asset_wrapper.rb', line 16

def private_download_url(expires_in: 1.day)
  service_url(disposition: 'attachment', expires_in: expires_in)
end

#private_url(expires_in: 1.day) ⇒ Object



12
13
14
# File 'lib/tessa/active_storage/asset_wrapper.rb', line 12

def private_url(expires_in: 1.day)
  service_url(disposition: :inline, expires_in: expires_in)
end

#public_urlObject



7
8
9
10
# File 'lib/tessa/active_storage/asset_wrapper.rb', line 7

def public_url
  Rails.application.routes.url_helpers.
    rails_blob_url(__getobj__, disposition: :inline)
end