Class: DragonflySvg::Analysers::LandscapeAnalyser

Inherits:
Base
  • Object
show all
Defined in:
lib/dragonfly_svg/analysers/landscape_analyser.rb

Instance Method Summary collapse

Methods inherited from Base

#is_svg?

Constructor Details

#initialize(app) ⇒ LandscapeAnalyser

Returns a new instance of LandscapeAnalyser.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/dragonfly_svg/analysers/landscape_analyser.rb', line 4

def initialize(app)
  original = app.analysers.items[:landscape]
  app.add_analyser(:landscape) do |content|
    if is_svg?(content)
      attrs = content.analyse(:svg_properties)
      attrs[:width] >= attrs[:height]
    elsif original
      original.call(content)
    end
  end
end