Parent

Class/Module Index [+]

Quicksearch

Compass::SassExtensions::Sprites::RowFitter

Attributes

images[R]
rows[R]

Public Class Methods

new(images) click to toggle source
# File lib/compass/sass_extensions/sprites/row_fitter.rb, line 12
def initialize(images)
  @images = images.sort do |a,b|
    if a.height == b.height
      b.width <=> a.width
    else
      a.height <=> b.height
    end
  end
  @rows = []
end

Public Instance Methods

efficiency() click to toggle source
# File lib/compass/sass_extensions/sprites/row_fitter.rb, line 36
def efficiency
  @rows.inject(0) { |sum, row| sum += row.efficiency } ** @rows.length
end
fit!(style = :scan) click to toggle source
# File lib/compass/sass_extensions/sprites/row_fitter.rb, line 23
def fit!(style = :scan)
  send("#{style}_fit")
  @rows
end
height() click to toggle source
# File lib/compass/sass_extensions/sprites/row_fitter.rb, line 32
def height
  @height ||= @rows.inject(0) {|sum, row| sum += row.height}
end
width() click to toggle source
# File lib/compass/sass_extensions/sprites/row_fitter.rb, line 28
def width
  @width ||= @images.collect(&:width).max
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.