lib/storage.rb in storage-0.1.0 vs lib/storage.rb in storage-0.1.1
- old
+ new
@@ -6,42 +6,40 @@
module Storage
autoload :Config, "storage/config"
autoload :Strategies, "storage/strategies"
autoload :Version, "storage/version"
- class << self
- # Set up the storage options.
- #
- # Storage.setup do |config|
- # config.strategy = :s3
- # end
- #
- # Check Storage::Config for available options.
- #
- def setup(&block)
- yield Config
- strategy.prepare!
- end
+ # Set up the storage options.
+ #
+ # Storage.setup do |config|
+ # config.strategy = :s3
+ # end
+ #
+ # Check Storage::Config for available options.
+ #
+ def self.setup(&block)
+ yield Config
+ strategy.prepare!
+ end
- # A shortcut to the current strategy.
- def strategy
- Config.strategy_class
- end
+ # A shortcut to the current strategy.
+ def self.strategy
+ Config.strategy_class
+ end
- # Save a file.
- def store(*args)
- strategy.store(*args)
- end
+ # Save a file.
+ def self.store(*args)
+ strategy.store(*args)
+ end
- # Destroy a file.
- def remove(*args)
- strategy.remove(*args)
- end
+ # Destroy a file.
+ def self.remove(*args)
+ strategy.remove(*args)
+ end
- # Retrieve a file.
- def get(*args)
- strategy.get(*args)
- end
+ # Retrieve a file.
+ def self.get(*args)
+ strategy.get(*args)
end
end
Storage::Strategies.register :s3, Storage::Strategies::S3
Storage::Strategies.register :file, Storage::Strategies::FileSystem