Sha256: 9608f8be65ebfbb6e7413b2f04c113389b1b92e4260317ff7b0a51e6ff9d98e4

Contents?: true

Size: 1.03 KB

Versions: 11

Compression:

Stored size: 1.03 KB

Contents

require 'pathname'
require 'digest/sha1'
require "fileutils"

module Tori
  class << self
    def config
      @config ||= Config.new.tap do |config|
        # Default backend config
        #   You can change setting any time.
        #   Recommend to create config/initializer/tori.rb for setting.

        # Configure for file store backend instance.
        config.backend = Tori::Backend::FileSystem.new(Pathname("tmp/tori"))

        # You can also use S3 backend.
        # It take 'aws-sdk-core' gem.
        # S3 example
        #   require 'tori/backend/s3'
        #   config.backend = Tori::Backend::S3.new(bucket: 'tori_bucket')

        # Filename hashing method
        #   It's call when decide filename hash.
        config.filename_callback do |model|
          Digest::SHA1.hexdigest "#{model.class.name}/#{model.id}"
        end
      end
    end
  end
end

require 'tori/backend/filesystem'
require 'tori/backend/chain'
require 'tori/config'
require 'tori/context'
require 'tori/define'
require 'tori/file'
require 'tori/version'

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tori-0.8.0 lib/tori.rb
tori-0.7.2 lib/tori.rb
tori-0.7.1 lib/tori.rb
tori-0.7.0 lib/tori.rb
tori-0.6.6 lib/tori.rb
tori-0.6.5 lib/tori.rb
tori-0.6.4 lib/tori.rb
tori-0.6.3 lib/tori.rb
tori-0.6.2 lib/tori.rb
tori-0.6.1 lib/tori.rb
tori-0.6.0 lib/tori.rb