Commit acc8f754 by Jon Yurek

Switched interpolations module from module methods to instance methods

parent 4fc132f0
module Paperclip
module Interpolations
extend self
def self.[]= name, block
(class << self; self; end).class_eval do
define_method(name, &block)
end
define_method(name, &block)
end
def self.[] name
......@@ -11,43 +11,43 @@ module Paperclip
end
def self.all
(singleton_methods - ["[]=", "[]", "all"]).sort
self.instance_methods(false).sort
end
def self.rails_root attachment, style
def rails_root attachment, style
RAILS_ROOT
end
def self.rails_env attachment, style
def rails_env attachment, style
RAILS_ENV
end
def self.class attachment, style
def class attachment, style
attachment.instance.class.to_s.underscore.pluralize
end
def self.basename attachment, style
def basename attachment, style
attachment.original_filename.gsub(/#{File.extname(attachment.original_filename)}$/, "")
end
def self.extension attachment, style
def extension attachment, style
((style = attachment.styles[style]) && style[:format]) ||
File.extname(attachment.original_filename).gsub(/^\.+/, "")
end
def self.id attachment, style
def id attachment, style
attachment.instance.id
end
def self.id_partition attachment, style
def id_partition attachment, style
("%09d" % attachment.instance.id).scan(/\d{3}/).join("/")
end
def self.attachment attachment, style
def attachment attachment, style
attachment.name.to_s.downcase.pluralize
end
def self.style attachment, style
def style attachment, style
style || attachment.default_style
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment