Sha256: 071d002563ca01321f15376e5e748163659be66758dfbf3b261b51c8462c5b78

Contents?: true

Size: 928 Bytes

Versions: 3

Compression:

Stored size: 928 Bytes

Contents

require "ostruct"
require "fileutils" unless defined?(FileUtils)
require "storage/errors"
require "aws/s3"

module Storage
  autoload :Config,       "storage/config"
  autoload :Strategies,   "storage/strategies"
  autoload :Version,      "storage/version"

  # 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
  end

  # A shortcut to the current strategy.
  def self.strategy
    Config.strategy_class
  end

  # Save a file.
  def self.store(*args)
    strategy.store(*args)
  end

  # Destroy a file.
  def self.remove(*args)
    strategy.remove(*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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
storage-0.1.5 lib/storage.rb
storage-0.1.3 lib/storage.rb
storage-0.1.2 lib/storage.rb