Class: Imgproxy::Options
- Inherits:
-
Hash
- Object
- Hash
- Imgproxy::Options
- Defined in:
- lib/imgproxy/options.rb
Overview
Formats and regroups processing options
Constant Summary collapse
- STRING_OPTS =
i[resizing_type gravity crop_gravity watermark_position watermark_url style cachebuster format].freeze
- INT_OPTS =
i[width height crop_width crop_height quality brightness pixelate watermark_x_offset watermark_y_offset].freeze
- FLOAT_OPTS =
i[dpr gravity_x gravity_y crop_gravity_x crop_gravity_y contrast saturation blur sharpen watermark_opacity watermark_scale].freeze
- BOOL_OPTS =
i[enlarge extend].freeze
- ARRAY_OPTS =
i[background preset].freeze
- ALL_OPTS =
(STRING_OPTS + INT_OPTS + FLOAT_OPTS + BOOL_OPTS + ARRAY_OPTS).freeze
- OPTS_PRIORITY =
i[ crop resize size resizing_type width height dpr enlarge extend gravity quality background blur sharpen pixelate watermark watermark_url preset cachebuster ].freeze
Instance Method Summary collapse
-
#initialize(options) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(options) ⇒ Options
Returns a new instance of Options.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/imgproxy/options.rb', line 19 def initialize() merge!(.slice(*ALL_OPTS)) typecast encode_style encode_watermark_url replace(Hash[sort_by { |k, _| OPTS_PRIORITY.index(k) || 99 }]) freeze end |