lib/dragonfly_libvips/plugin.rb in dragonfly_libvips-2.5.0 vs lib/dragonfly_libvips/plugin.rb in dragonfly_libvips-2.5.1
- old
+ new
@@ -1,11 +1,13 @@
-require 'dragonfly_libvips/analysers/image_properties'
-require 'dragonfly_libvips/processors/encode'
-require 'dragonfly_libvips/processors/extract_area'
-require 'dragonfly_libvips/processors/rotate'
-require 'dragonfly_libvips/processors/thumb'
+# frozen_string_literal: true
+require "dragonfly_libvips/analysers/image_properties"
+require "dragonfly_libvips/processors/encode"
+require "dragonfly_libvips/processors/extract_area"
+require "dragonfly_libvips/processors/rotate"
+require "dragonfly_libvips/processors/thumb"
+
module DragonflyLibvips
class Plugin
def call(app, _opts = {})
# Analysers
app.add_analyser :image_properties, DragonflyLibvips::Analysers::ImageProperties.new
@@ -22,14 +24,12 @@
app.add_analyser(:aspect_ratio) { |c| c.analyse(:width).to_f / c.analyse(:height).to_f }
app.add_analyser(:portrait) { |c| c.analyse(:aspect_ratio) < 1.0 }
app.add_analyser(:landscape) { |c| !c.analyse(:portrait) }
app.add_analyser(:image) do |c|
- begin
- c.analyse(:image_properties).key?('format')
- rescue ::Vips::Error
- false
- end
+ c.analyse(:image_properties).key?("format")
+ rescue ::Vips::Error
+ false
end
# Aliases
app.define(:portrait?) { portrait }
app.define(:landscape?) { landscape }