Module: Dragonfly::GeometryBridge
- Defined in:
- lib/dragonfly/geometry_bridge.rb
Class Method Summary collapse
Class Method Details
.translate(geometry, opts) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dragonfly/geometry_bridge.rb', line 19 def translate(geometry, opts) return [geometry, opts] unless geometry.is_a?(String) match = geometry.match(/\A(?<dims>\d*x\d*)#(?<gravity>[A-Za-z]+)?\z/) return [geometry, opts] unless match new_opts = opts.dup new_opts[:thumbnail_options] ||= {} new_opts[:thumbnail_options][:crop] ||= :centre [match[:dims], new_opts] end |