Class: Imgproxy::Builder
- Inherits:
-
Object
- Object
- Imgproxy::Builder
- Defined in:
- lib/imgproxy/builder.rb
Overview
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Builder
constructor
A new instance of Builder.
-
#url_for(image) ⇒ String
Genrates imgproxy URL.
Constructor Details
#initialize(options = {}) ⇒ Builder
Returns a new instance of Builder.
22 23 24 25 26 27 28 29 |
# File 'lib/imgproxy/builder.rb', line 22 def initialize( = {}) = .dup @use_short_options = .delete(:use_short_options) @use_short_options = config. if @use_short_options.nil? @options = Imgproxy::Options.new() end |
Instance Method Details
#url_for(image) ⇒ String
Genrates imgproxy URL
37 38 39 40 41 42 43 44 |
# File 'lib/imgproxy/builder.rb', line 37 def url_for(image) path = [*, "plain", url(image)].join("/") path = "#{path}@#{@options[:format]}" if @options[:format] signature = sign_path(path) URI.join(Imgproxy.config.endpoint.to_s, "#{signature}/#{path}").to_s end |