lib/tori.rb in tori-0.0.1 vs lib/tori.rb in tori-0.0.2

- old
+ new

@@ -8,11 +8,22 @@ 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")) - config.hash_method = Digest::MD5.method(:hexdigest) + + # Filename hashing method + # It's call when decide filename hash. + # `filename_callback` must be have `call` method. + config.filename_callback = ->(model) do + Digest::MD5.hexdigest "#{model.class.name}/#{model.id}" + end end end end end