Class: Bridgetown::ImagePipeline::Config
- Inherits:
-
Struct
- Object
- Struct
- Bridgetown::ImagePipeline::Config
- Defined in:
- lib/bridgetown/image_pipeline/config.rb
Constant Summary collapse
- DEFAULTS =
{ source_globs: ["src/images/**/*.{jpg,jpeg,png}"], exclude: [], widths: [400, 600, 800, 1200, 1600], formats: %i[avif webp], output_dir: "_bridgetown/image_pipeline", quality: { avif: 65, webp: 88, jpeg: 88 }, auto_rewrite: false, fail_on_missing: false, breakpoints: { 640 => 400, 768 => 600, 1024 => 800, 1280 => 1200 }, default_width: 1600 }.freeze
Instance Attribute Summary collapse
-
#auto_rewrite ⇒ Object
Returns the value of attribute auto_rewrite.
-
#breakpoints ⇒ Object
Returns the value of attribute breakpoints.
-
#default_width ⇒ Object
Returns the value of attribute default_width.
-
#exclude ⇒ Object
Returns the value of attribute exclude.
-
#fail_on_missing ⇒ Object
Returns the value of attribute fail_on_missing.
-
#formats ⇒ Object
Returns the value of attribute formats.
-
#output_dir ⇒ Object
Returns the value of attribute output_dir.
-
#quality ⇒ Object
Returns the value of attribute quality.
-
#source_globs ⇒ Object
Returns the value of attribute source_globs.
-
#widths ⇒ Object
Returns the value of attribute widths.
Class Method Summary collapse
-
.from(**overrides) ⇒ Object
Build a Config from initializer kwargs.
Instance Attribute Details
#auto_rewrite ⇒ Object
Returns the value of attribute auto_rewrite
5 6 7 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 5 def auto_rewrite @auto_rewrite end |
#breakpoints ⇒ Object
Returns the value of attribute breakpoints
5 6 7 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 5 def breakpoints @breakpoints end |
#default_width ⇒ Object
Returns the value of attribute default_width
5 6 7 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 5 def default_width @default_width end |
#exclude ⇒ Object
Returns the value of attribute exclude
5 6 7 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 5 def exclude @exclude end |
#fail_on_missing ⇒ Object
Returns the value of attribute fail_on_missing
5 6 7 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 5 def fail_on_missing @fail_on_missing end |
#formats ⇒ Object
Returns the value of attribute formats
5 6 7 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 5 def formats @formats end |
#output_dir ⇒ Object
Returns the value of attribute output_dir
5 6 7 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 5 def output_dir @output_dir end |
#quality ⇒ Object
Returns the value of attribute quality
5 6 7 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 5 def quality @quality end |
#source_globs ⇒ Object
Returns the value of attribute source_globs
5 6 7 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 5 def source_globs @source_globs end |
#widths ⇒ Object
Returns the value of attribute widths
5 6 7 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 5 def widths @widths end |
Class Method Details
.from(**overrides) ⇒ Object
Build a Config from initializer kwargs. Unknown keys raise.
24 25 26 27 28 29 |
# File 'lib/bridgetown/image_pipeline/config.rb', line 24 def self.from(**overrides) merged = DEFAULTS.merge(overrides) merged[:formats] = Array(merged[:formats]).map(&:to_sym) merged[:quality] = DEFAULTS[:quality].merge(merged[:quality] || {}) new(**merged) end |