Module: DerivedImages::Dsl
- Included in:
- Manifest
- Defined in:
- lib/derived_images/dsl.rb
Overview
Note:
An image format conversions can be automatically inferred from the ‘target` file extension in these methods.
Use these DSL functions in your ‘config/derived_images.rb` file to define images to derive.
Instance Method Summary collapse
-
#derive(target, from:) {|pipeline| ... } ⇒ ManifestEntry
Derive one image from another, with full customization abilities.
-
#resize(target, from:, width:, height:) ⇒ ManifestEntry
Resize an image, preserving its aspect ratio.
Instance Method Details
#derive(target, from:) {|pipeline| ... } ⇒ ManifestEntry
Derive one image from another, with full customization abilities.
25 26 27 28 29 |
# File 'lib/derived_images/dsl.rb', line 25 def derive(target, from:, &block) entry = ManifestEntry.new(from, target) entry.pipeline = yield(entry.pipeline) if block add_entry(entry) end |
#resize(target, from:, width:, height:) ⇒ ManifestEntry
Resize an image, preserving its aspect ratio.
15 16 17 |
# File 'lib/derived_images/dsl.rb', line 15 def resize(target, from:, width:, height:) derive(target, from: from) { _1.resize_to_limit(width, height) } end |