Sha256: e058e590af0dcb4b43a084d5f44ed04dc5d22997f9423d3f61699bf7d5d92495

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

module PaperclipPrivate
	module Interpolations

    def self.extended(base)
      base.instance_eval do
        ::PaperclipPrivate::Interpolations.instance_methods(false).each { |m| define_method(m, self.method(m)) }
      end
    end

    # Returns the privacy
    def privacy(attachment, style_name)
      # attachment.options[:privacy]
      privacy = attachment.options[:privacy]
      privacy.respond_to?(:call) ? privacy.call(attachment.instance) : privacy
    end

    # Returns the class name without pluarlizing it.
    def klass(attachment, style_name)
      attachment.instance.class
    end

    # Returns the attachment name without pluralizing it
    def attachment_singular(attachment, style_name)
      attachment.name
    end

	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paperclip_private-0.0.3 lib/paperclip_private/interpolations.rb