Module: PaperclipPrivate::Interpolations

Defined in:
lib/paperclip_private/interpolations.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



4
5
6
7
8
# File 'lib/paperclip_private/interpolations.rb', line 4

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

Instance Method Details

#attachment_singular(attachment, style_name) ⇒ Object

Returns the attachment name without pluralizing it



23
24
25
# File 'lib/paperclip_private/interpolations.rb', line 23

def attachment_singular(attachment, style_name)
  attachment.name
end

#klass(attachment, style_name) ⇒ Object

Returns the class name without pluarlizing it.



18
19
20
# File 'lib/paperclip_private/interpolations.rb', line 18

def klass(attachment, style_name)
  attachment.instance.class
end

#privacy(attachment, style_name) ⇒ Object

Returns the privacy



11
12
13
14
15
# File 'lib/paperclip_private/interpolations.rb', line 11

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