Class: Paperclip::UrlGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/paperclip/url_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attachment) ⇒ UrlGenerator

Returns a new instance of UrlGenerator.



13
14
15
# File 'lib/paperclip/url_generator.rb', line 13

def initialize(attachment)
  @attachment = attachment
end

Class Method Details

.encoderObject



7
8
9
# File 'lib/paperclip/url_generator.rb', line 7

def encoder
  @encoder ||= URI::RFC2396_Parser.new
end

Instance Method Details

#for(style_name, options) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/paperclip/url_generator.rb', line 17

def for(style_name, options)
  interpolated = attachment_options[:interpolator].interpolate(
    most_appropriate_url, @attachment, style_name
  )

  escaped = escape_url_as_needed(interpolated, options)
  timestamp_as_needed(escaped, options)
end