Class: Imgproxy::Config

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

Overview

Imgproxy config

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig



20
21
22
23
# File 'lib/imgproxy/config.rb', line 20

def initialize
  self.signature_size = 32
  self.use_short_options = true
end

Instance Attribute Details

#endpointString



8
9
10
# File 'lib/imgproxy/config.rb', line 8

def endpoint
  @endpoint
end

#keyString



10
11
12
# File 'lib/imgproxy/config.rb', line 10

def key
  @key
end

#saltString



12
13
14
# File 'lib/imgproxy/config.rb', line 12

def salt
  @salt
end

#signature_sizeInteger



14
15
16
# File 'lib/imgproxy/config.rb', line 14

def signature_size
  @signature_size
end

#use_short_optionsBoolean



18
19
20
# File 'lib/imgproxy/config.rb', line 18

def use_short_options
  @use_short_options
end

Instance Method Details

#hex_key=(value) ⇒ Object

Decodes hex-encoded key and sets it to #key



28
29
30
# File 'lib/imgproxy/config.rb', line 28

def hex_key=(value)
  self.key = [value].pack("H*")
end

#hex_salt=(value) ⇒ Object

Decodes hex-encoded salt and sets it to #salt



35
36
37
# File 'lib/imgproxy/config.rb', line 35

def hex_salt=(value)
  self.salt = [value].pack("H*")
end

#url_adaptersImgproxy::UrlAdapters

URL adapters config. Allows to use this gem with ActiveStorage, Shrine, etc.

Imgproxy.configure do |config|
config.url_adapters.add Imgproxy::UrlAdapters::ActiveStorage.new
end

Imgproxy.url_for(user.avatar)

See Also:



54
55
56
# File 'lib/imgproxy/config.rb', line 54

def url_adapters
  @url_adapters ||= Imgproxy::UrlAdapters.new
end