Module: CarrierWave
- Defined in:
- lib/carrierwave.rb,
lib/carrierwave.rb,
lib/carrierwave.rb,
lib/carrierwave/error.rb,
lib/carrierwave/mount.rb,
lib/carrierwave/mounter.rb,
lib/carrierwave/version.rb,
lib/carrierwave/uploader.rb,
lib/carrierwave/utilities.rb,
lib/carrierwave/storage/fog.rb,
lib/carrierwave/storage/file.rb,
lib/carrierwave/uploader/url.rb,
lib/carrierwave/test/matchers.rb,
lib/carrierwave/utilities/uri.rb,
lib/carrierwave/sanitized_file.rb,
lib/carrierwave/uploader/cache.rb,
lib/carrierwave/uploader/proxy.rb,
lib/carrierwave/uploader/store.rb,
lib/carrierwave/downloader/base.rb,
lib/carrierwave/processing/vips.rb,
lib/carrierwave/uploader/remove.rb,
lib/carrierwave/orm/activerecord.rb,
lib/carrierwave/storage/abstract.rb,
lib/carrierwave/uploader/download.rb,
lib/carrierwave/uploader/versions.rb,
lib/carrierwave/processing/rmagick.rb,
lib/carrierwave/uploader/callbacks.rb,
lib/carrierwave/uploader/dimension.rb,
lib/carrierwave/uploader/file_size.rb,
lib/carrierwave/uploader/mountable.rb,
lib/carrierwave/uploader/processing.rb,
lib/carrierwave/utilities/file_name.rb,
lib/carrierwave/uploader/default_url.rb,
lib/carrierwave/downloader/remote_file.rb,
lib/carrierwave/processing/mini_magick.rb,
lib/carrierwave/uploader/configuration.rb,
lib/carrierwave/uploader/serialization.rb,
lib/carrierwave/compatibility/paperclip.rb,
lib/carrierwave/validations/active_model.rb,
lib/carrierwave/uploader/extension_denylist.rb,
lib/carrierwave/uploader/extension_allowlist.rb,
lib/carrierwave/uploader/content_type_denylist.rb,
lib/carrierwave/uploader/content_type_allowlist.rb
Defined Under Namespace
Modules: ActiveRecord, Compatibility, Downloader, MiniMagick, Mount, RMagick, Storage, Test, Uploader, Utilities, Validations, Vips Classes: CacheCounter, DownloadError, FormNotMultipart, IntegrityError, InvalidParameter, Mounter, ProcessingError, Railtie, SanitizedFile, Turbine, UnknownStorageError, UploadError
Constant Summary collapse
- VERSION =
"3.1.0".freeze
Class Attribute Summary collapse
-
.base_path ⇒ Object
Returns the value of attribute base_path.
-
.root ⇒ Object
Returns the value of attribute root.
- .tmp_path ⇒ Object
Class Method Summary collapse
- .clean_cached_files!(seconds = 60*60*24) ⇒ Object
- .configure(&block) ⇒ Object
- .deprecator ⇒ Object
-
.generate_cache_id ⇒ Object
Generates a unique cache id for use in the caching system.
Class Attribute Details
.base_path ⇒ Object
Returns the value of attribute base_path.
11 12 13 |
# File 'lib/carrierwave.rb', line 11 def base_path @base_path end |
.root ⇒ Object
Returns the value of attribute root.
11 12 13 |
# File 'lib/carrierwave.rb', line 11 def root @root end |
.tmp_path ⇒ Object
22 23 24 |
# File 'lib/carrierwave.rb', line 22 def tmp_path @tmp_path ||= File.(File.join('..', 'tmp'), root) end |
Class Method Details
.clean_cached_files!(seconds = 60*60*24) ⇒ Object
18 19 20 |
# File 'lib/carrierwave.rb', line 18 def clean_cached_files!(seconds=60*60*24) CarrierWave::Uploader::Base.clean_cached_files!(seconds) end |
.configure(&block) ⇒ Object
14 15 16 |
# File 'lib/carrierwave.rb', line 14 def configure(&block) CarrierWave::Uploader::Base.configure(&block) end |
.deprecator ⇒ Object
26 27 28 |
# File 'lib/carrierwave.rb', line 26 def deprecator @deprecator ||= ActiveSupport::Deprecation.new("#{CarrierWave::VERSION.split('.')[0].to_i + 1}.0", "CarrierWave") end |
.generate_cache_id ⇒ Object
Generates a unique cache id for use in the caching system
Returns
- String
-
a cache id in the format TIMEINT-PID-COUNTER-RND
26 27 28 29 30 31 32 33 |
# File 'lib/carrierwave/uploader/cache.rb', line 26 def self.generate_cache_id [ Time.now.utc.to_i, SecureRandom.random_number(1_000_000_000_000_000), '%04d' % (CarrierWave::CacheCounter.increment % 10_000), '%04d' % SecureRandom.random_number(10_000) ].map(&:to_s).join('-') end |