Class: Uploadcare::Rails::Transformations::ImageTransformations

Inherits:
Object
  • Object
show all
Defined in:
lib/uploadcare/rails/transformations/image_transformations.rb

Overview

A class for building image urls after image transformations.

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ImageTransformations

Returns a new instance of ImageTransformations.

Raises:

  • (ArgumentError)


10
11
12
13
14
# File 'lib/uploadcare/rails/transformations/image_transformations.rb', line 10

def initialize(options = {})
  raise ArgumentError, "Options argument must be a Hash, #{options.class} is given?" unless options.is_a?(Hash)

  @options = options.to_h { |k, v| [k.to_sym, v] }
end

Instance Method Details

#callObject



16
17
18
# File 'lib/uploadcare/rails/transformations/image_transformations.rb', line 16

def call
  options_to_a.compact.join('-').squeeze('/').gsub(/\s/, '').presence
end