Class: Imgproxy::Options
- Inherits:
-
Hash
- Object
- Hash
- Imgproxy::Options
- Defined in:
- lib/imgproxy/options.rb
Overview
Formats and regroups processing options
Constant Summary collapse
- CASTERS =
{ resize: Imgproxy::OptionsCasters::Resize, size: Imgproxy::OptionsCasters::Size, resizing_type: Imgproxy::OptionsCasters::String, resizing_algorithm: Imgproxy::OptionsCasters::String, width: Imgproxy::OptionsCasters::Integer, height: Imgproxy::OptionsCasters::Integer, dpr: Imgproxy::OptionsCasters::Float, enlarge: Imgproxy::OptionsCasters::Bool, extend: Imgproxy::OptionsCasters::Extend, gravity: Imgproxy::OptionsCasters::Gravity, crop: Imgproxy::OptionsCasters::Crop, padding: Imgproxy::OptionsCasters::Array, trim: Imgproxy::OptionsCasters::Trim, rotate: Imgproxy::OptionsCasters::Integer, quality: Imgproxy::OptionsCasters::Integer, max_bytes: Imgproxy::OptionsCasters::Integer, background: Imgproxy::OptionsCasters::Array, background_alpha: Imgproxy::OptionsCasters::Float, adjust: Imgproxy::OptionsCasters::Adjust, brightness: Imgproxy::OptionsCasters::Integer, contrast: Imgproxy::OptionsCasters::Float, saturation: Imgproxy::OptionsCasters::Float, blur: Imgproxy::OptionsCasters::Float, sharpen: Imgproxy::OptionsCasters::Float, pixelate: Imgproxy::OptionsCasters::Integer, unsharpening: Imgproxy::OptionsCasters::String, watermark: Imgproxy::OptionsCasters::Watermark, watermark_url: Imgproxy::OptionsCasters::Base64, style: Imgproxy::OptionsCasters::Base64, jpeg_options: Imgproxy::OptionsCasters::JpegOptions, png_options: Imgproxy::OptionsCasters::PngOptions, gif_options: Imgproxy::OptionsCasters::GifOptions, page: Imgproxy::OptionsCasters::Integer, video_thumbnail_second: Imgproxy::OptionsCasters::Integer, preset: Imgproxy::OptionsCasters::Array, cachebuster: Imgproxy::OptionsCasters::String, strip_metadata: Imgproxy::OptionsCasters::Bool, strip_color_profile: Imgproxy::OptionsCasters::Bool, auto_rotate: Imgproxy::OptionsCasters::Bool, filename: Imgproxy::OptionsCasters::String, format: Imgproxy::OptionsCasters::String, }.freeze
- META =
%i[size resize adjust].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.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/imgproxy/options.rb', line 72 def initialize() # Options order hack: initialize known and meta options with nil value to preserve order CASTERS.each_key { |n| self[n] = nil if .key?(n) || META.include?(n) } .each do |name, value| caster = CASTERS[name] self[name] = caster ? caster.cast(value) : unwrap_hash(value) end group_resizing_opts group_adjust_opts compact! end |