Sha256: 84528f87fa373265b9e92d27c905facde2f708373d90b4f20ca17cf10ef21e76

Contents?: true

Size: 871 Bytes

Versions: 4

Compression:

Stored size: 871 Bytes

Contents

module Storage
  class Config
    class << self
      # Set a storage strategy based on its registered name.
      #
      #   Storage::Config.strategy = :s3
      #
      attr_accessor :strategy

      # Set a storage class.
      #
      #   Storage::Config.strategy_class = Storage::Strategies::S3
      #
      attr_accessor :strategy_class

      # Set the S3 default bucket.
      attr_accessor :bucket

      # Set the S3 access key.
      attr_accessor :access_key

      # Set the S3 secret key
      attr_accessor :secret_key

      # Set the FileSystem storage path.
      attr_accessor :path
    end

    # Override setter so we can automatically define the strategy class
    # based on its registered name.
    def self.strategy=(strategy)
      @strategy_class = eval(Storage::Strategies::STRATEGIES[strategy])
      @strategy = strategy
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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