Class: Imgproxy::UrlBuilders::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/imgproxy/url_builders/base.rb

Overview

Builds imgproxy URL

builder = Imgproxy::UrlBuilders::Base.new(
  width: 500,
  height: 400,
  resizing_type: :fill,
  sharpen: 0.5
)

builder.url_for("http://images.example.com/images/image1.jpg")
builder.url_for("http://images.example.com/images/image2.jpg")

Direct Known Subclasses

Info, Processing

Constant Summary collapse

OPTIONS_BUILDER =
OptionsBuilders::Base
OPTION_ALIASES =
{}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.

Parameters:

  • options (Hash) (defaults to: {})

    imgproxy URL options

See Also:



33
34
35
36
37
38
39
# File 'lib/imgproxy/url_builders/base.rb', line 33

def initialize(options = {})
  options = options.dup

  extract_builder_options(options)

  @options = self.class::OPTIONS_BUILDER.new(options)
end

Instance Method Details

#url_for(_image) ⇒ String

Genrates imgproxy URL

Parameters:

  • _image (String, URI, Object)

    Source image URL or object applicable for the configured URL adapters

Returns:

  • (String)

    imgproxy URL

Raises:

  • (NotImplementedError)

See Also:



48
49
50
# File 'lib/imgproxy/url_builders/base.rb', line 48

def url_for(_image)
  raise NotImplementedError
end