Sha256: ddaa3e37ec9ec1d2d9c979ccd6708026ed0d109075bf907e0f6af549f17e1be9

Contents?: true

Size: 851 Bytes

Versions: 1

Compression:

Stored size: 851 Bytes

Contents

require 'tori/backend/filesystem'
require 'tori/config'
require 'tori/define'
require 'tori/file'
require 'tori/version'
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"))

        # Filename hashing method
        #   It's call when decide filename hash.
        #   `filename_callback` must be have `call` method.
        config.filename_callback = ->(model) do
          Digest::SHA1.hexdigest "#{model.class.name}/#{model.id}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tori-0.0.3 lib/tori.rb