"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/sass/script/value/number.rb" between
sass-3.5.5.tar.gz and sass-3.5.6.tar.gz

About: Sass (Syntactically Awesome StyleSheets) is a CSS preprocessor (extension language) that adds "power and elegance" to the basic CSS language.

number.rb  (sass-3.5.5):number.rb  (sass-3.5.6)
skipping to change at line 192 skipping to change at line 192
end end
# The SassScript `%` operation. # The SassScript `%` operation.
# #
# @param other [Number] The right-hand side of the operator # @param other [Number] The right-hand side of the operator
# @return [Number] This number modulo the other # @return [Number] This number modulo the other
# @raise [NoMethodError] if `other` is an invalid type # @raise [NoMethodError] if `other` is an invalid type
# @raise [Sass::UnitConversionError] if `other` has incompatible units # @raise [Sass::UnitConversionError] if `other` has incompatible units
def mod(other) def mod(other)
if other.is_a?(Number) if other.is_a?(Number)
return Number.new(Float::NAN) if other.value == 0
operate(other, :%) operate(other, :%)
else else
raise NoMethodError.new(nil, :mod) raise NoMethodError.new(nil, :mod)
end end
end end
# The SassScript `==` operation. # The SassScript `==` operation.
# #
# @param other [Value] The right-hand side of the operator # @param other [Value] The right-hand side of the operator
# @return [Boolean] Whether this number is equal to the other object # @return [Boolean] Whether this number is equal to the other object
skipping to change at line 475 skipping to change at line 476
[this.numerator_units, this.denominator_units] [this.numerator_units, this.denominator_units]
end end
end end
def normalize! def normalize!
return if unitless? return if unitless?
@numerator_units, @denominator_units = @numerator_units, @denominator_units =
sans_common_units(@numerator_units, @denominator_units) sans_common_units(@numerator_units, @denominator_units)
@denominator_units.each_with_index do |d, i| @denominator_units.each_with_index do |d, i|
next unless convertable?(d) && (u = @numerator_units.find(&method(:conve rtable?))) next unless convertable?(d) && (u = @numerator_units.find {|n| convertab le?([n, d])})
@value /= conversion_factor(d, u) @value /= conversion_factor(d, u)
@denominator_units.delete_at(i) @denominator_units.delete_at(i)
@numerator_units.delete_at(@numerator_units.index(u)) @numerator_units.delete_at(@numerator_units.index(u))
end end
end end
# This is the source data for all the unit logic. It's pre-processed to make # This is the source data for all the unit logic. It's pre-processed to make
# it efficient to figure out whether a set of units is mutually compatible # it efficient to figure out whether a set of units is mutually compatible
# and what the conversion ratio is between two units. # and what the conversion ratio is between two units.
# #
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)