module Paperclip::Storage::TokyoTyrant
Public Class Methods
extended(base)
click to toggle source
# File lib/paperclip/storage/tokyo_tyrant.rb, line 4 def self.extended base begin require 'rufus/tokyo/tyrant' rescue LoadError => e e.message << " (You may need to install the rufus-tokyo gem)" raise e end end
Public Instance Methods
copy_to_local_file(style, local_dest_path)
click to toggle source
# File lib/paperclip/storage/tokyo_tyrant.rb, line 51 def copy_to_local_file(style, local_dest_path) log("copying #{path(style)} to local file #{local_dest_path}") local_file = ::File.open(local_dest_path, 'wb') tt_bucket[path(style).sub(%r{^/},'')] = local_file.read rescue warn("cannot copy #{path(style)} to local file #{local_dest_path}") false end
exists?(style_name = default_style)
click to toggle source
# File lib/paperclip/storage/tokyo_tyrant.rb, line 13 def exists?(style_name = default_style) if original_filename tt_object(style_name) else false end end
tt_bucket()
click to toggle source
# File lib/paperclip/storage/tokyo_tyrant.rb, line 21 def tt_bucket @tt_bucket ||= Rufus::Tokyo::Tyrant.new(@options[:tt_host], @options[:tt_port]) end
tt_object(style_name = default_style)
click to toggle source
# File lib/paperclip/storage/tokyo_tyrant.rb, line 25 def tt_object style_name = default_style tt_bucket[path(style_name).sub(%r{^/},'')] end