Class: ActiverecordHoarder::Storages
- Inherits:
-
Object
- Object
- ActiverecordHoarder::Storages
- Defined in:
- lib/activerecord_hoarder/storages.rb
Constant Summary collapse
- STORAGE_DICT =
{ aws_s3: ::ActiverecordHoarder::AwsS3 }
Class Method Summary collapse
- .check_storage(storage_key) ⇒ Object
- .is_valid_storage?(storage_key) ⇒ Boolean
- .retrieve(storage_key) ⇒ Object
Class Method Details
.check_storage(storage_key) ⇒ Object
7 8 9 |
# File 'lib/activerecord_hoarder/storages.rb', line 7 def self.check_storage(storage_key) raise ::ActiverecordHoarder::StorageError.new("unknown storage (#{storage_key}), known keys are #{STORAGE_DICT.keys}") if !is_valid_storage?(storage_key) end |
.is_valid_storage?(storage_key) ⇒ Boolean
11 12 13 |
# File 'lib/activerecord_hoarder/storages.rb', line 11 def self.is_valid_storage?(storage_key) STORAGE_DICT.keys.include?(storage_key) end |
.retrieve(storage_key) ⇒ Object
15 16 17 18 |
# File 'lib/activerecord_hoarder/storages.rb', line 15 def self.retrieve(storage_key) check_storage(storage_key) STORAGE_DICT[storage_key] end |