All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gems.compass-1.0.3.lib.compass.sass_extensions.sprites.images.rb Maven / Gradle / Ivy

There is a newer version: 3.7.2
Show newest version
module Compass
  module SassExtensions
    module Sprites
      class Images < Array

        def sort_by!(method)
          invert = false
          if method.to_s[0] == '!'[0] # have todo this for 1.8.7 compat
            method = method.to_s[1..-1]
            invert = true
          end
          method = method.to_sym
          self.sort! do |a, b|
            unless a.send(method) == b.send(method)
              a.send(method) <=> b.send(method)
            else
              other = ([:size, :name] - [method]).first
              a.send(other) <=> b.send(other)
            end
          end
          self.reverse! if invert
        end



      end
    end
  end
end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy