Class: Alchemy::PictureAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/alchemy/picture_attributes.rb

Overview

Provides methods to secure your picture attributes against DOS attacks.

Constant Summary collapse

SECURE_ATTRIBUTES =
%w(id size crop crop_from crop_size quality upsample).freeze

Class Method Summary collapse

Class Method Details

.secure(attributes) ⇒ String

Secures given attributes

Parameters:

  • attributes (Hash)

Returns:

  • (String)

15
16
17
# File 'lib/alchemy/picture_attributes.rb', line 15

def secure(attributes)
  Digest::SHA1.hexdigest(joined_attributes(attributes))[0..15]
end