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 watermark_position style cachebuster format].freeze
- INT_OPTS =
%i[width height quality watermark_x_offset watermark_y_offset].freeze
- FLOAT_OPTS =
%i[dpr gravity_x gravity_y 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[ resize size resizing_type width height dpr enlarge extend gravity quality background blur sharpen watermark 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.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/imgproxy/options.rb', line 15 def initialize() merge!(.slice(*ALL_OPTS)) typecast group_resizing_opts group_gravity_opts group_watermark_opts encode_style replace(Hash[sort_by { |k, _| OPTS_PRIORITY.index(k) || 99 }]) freeze end |