Allow inspection of list size

This commit is contained in:
Chris Eppstein 2010-11-15 17:28:20 -08:00
parent cac1bf915f
commit 46eb667837

View File

@ -14,6 +14,9 @@ module Compass::SassExtensions::Functions::GradientSupport
def to_s def to_s
values.map {|v| v.to_s }.join(join_with) values.map {|v| v.to_s }.join(join_with)
end end
def size
values.size
end
end end
class SpaceList < List class SpaceList < List
@ -317,6 +320,10 @@ module Compass::SassExtensions::Functions::GradientSupport
SpaceList.new(*values) SpaceList.new(*values)
end end
def _compass_list_size(list)
Sass::Script::Number.new(list.size)
end
# Get the nth value from a list # Get the nth value from a list
def _compass_nth(list, place) def _compass_nth(list, place)
if place.value == "last" if place.value == "last"