Sha256: 6261b3bcaa3df765c0355f6e84b016324e0ae37fbbdc0e073fd55ff8c1d07034

Contents?: true

Size: 681 Bytes

Versions: 29

Compression:

Stored size: 681 Bytes

Contents

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

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/compass-1.0.3/lib/compass/sass_extensions/sprites/images.rb
compass-1.0.3 lib/compass/sass_extensions/sprites/images.rb
compass-1.1.0.alpha.3 lib/compass/sass_extensions/sprites/images.rb
compass-1.1.0.alpha.2 lib/compass/sass_extensions/sprites/images.rb
compass-1.1.0.alpha.1 lib/compass/sass_extensions/sprites/images.rb
compass-1.1.0.alpha.0 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.1 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.rc.1 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.rc.0 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.alpha.21 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.alpha.20 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.alpha.19 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.alpha.18 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.alpha.17 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.alpha.16 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.alpha.15 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.alpha.14 lib/compass/sass_extensions/sprites/images.rb
compass-1.0.0.alpha.13 lib/compass/sass_extensions/sprites/images.rb
compass-0.13.alpha.12 lib/compass/sass_extensions/sprites/images.rb