compass/src/test/testData/gems/compass-0.13.alpha.2/lib/compass/sass_extensions/functions/gradient_support.rb
def color_stops_in_percentages(color_list)
      assert_type color_list, :List
      color_list = normalize_stops(color_list)
      max = color_list.value.last.stop
      last_value = nil
      color_stops = color_list.value.map do |pos|
        # have to convert absolute units to percentages for use in color stop functions.
        stop = pos.stop
        stop = stop.div(max).times(Sass::Script::Number.new(100,["%"])) if stop.numerator_units == max.numerator_units && max.numerator_units != ["%"]
        # Make sure the color stops are specified in the right order.
        if last_value && stop.numerator_units == last_value.numerator_units && stop.denominator_units == last_value.denominator_units && (stop.value * 1000).round < (last_value.value * 1000).round
          raise Sass::SyntaxError.new("Color stops must be specified in increasing order. #{stop.value} came after #{last_value.value}.")
        end
        last_value = stop
        [stop, pos.color]
      end
    end
# given a position list, return a corresponding position in percents
# otherwise, returns the original argument
given a position list, return a corresponding position in percents
otherwise, returns the original argument
given a position list return a corresponding position in percents otherwise returns the original argument
def color_stops_in_percentages(color_list)
      assert_type color_list, :List
      color_list = normalize_stops(color_list)
      max = color_list.value.last.stop
      last_value = nil
      color_stops = color_list.value.map do |pos|
        stop = pos.stop
        stop = stop.div(max).times(Sass::Script::Number.new(100,["%"])) if stop.numerator_units == max.numerator_units && max.numerator_units != ["%"]
        if last_value && stop.numerator_units == last_value.numerator_units && stop.denominator_units == last_value.denominator_units && (stop.value * 1000).round < (last_value.value * 1000).round
          raise Sass::SyntaxError.new("Color stops must be specified in increasing order. #{stop.value} came after #{last_value.value}.")
        end
        last_value = stop
        [stop, pos.color]
      end
    end
def color_stops_in_percentages ( color_list ) assert_type color_list , :List color_list = normalize_stops ( color_list ) max = color_list . value . last . stop last_value = nil color_stops = color_list . value . map do | pos | stop = pos . stop stop = stop . div ( max ) . times ( Sass :: Script :: Number . new ( 100 , [ "%" ] ) ) if stop . numerator_units == max . numerator_units && max . numerator_units != [ "%" ] if last_value && stop . numerator_units == last_value . numerator_units && stop . denominator_units == last_value . denominator_units && ( stop . value * 1000 ) . round < ( last_value . value * 1000 ) . round raise Sass :: SyntaxError . new ( "Color stops must be specified in increasing order. #{stop.value} came after #{last_value.value}." ) end last_value = stop [ stop , pos . color ] end end
given a position list, return a corresponding position in percents
otherwise, returns the original argument
given a position list return a corresponding position in percents otherwise returns the original argument
# have to convert absolute units to percentages for use in color stop functions. # Make sure the color stops are specified in the right order.
color_list