Module: BetterStorage::Blob

Defined in:
lib/better_storage/blob.rb

Instance Method Summary collapse

Instance Method Details

#keyObject



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

def key
  self[:key] ||= begin
    parts = []
    parts << "dev" if Rails.env.development?
    parts << Date.today.strftime(BetterStorage.prefix_date_format) if BetterStorage.prefix_date_format
    parts << self.class.generate_unique_secure_token(length: self.class::MINIMUM_TOKEN_LENGTH)
    parts.join("/")
  end
end

#public_urlObject



13
14
15
# File 'lib/better_storage/blob.rb', line 13

def public_url
  BetterStorage.public_url(key)
end