lib/sass/script/value/number.rb in sass-3.5.5 vs lib/sass/script/value/number.rb in sass-3.5.6
- old
+ new
@@ -187,10 +187,11 @@
# @return [Number] This number modulo the other
# @raise [NoMethodError] if `other` is an invalid type
# @raise [Sass::UnitConversionError] if `other` has incompatible units
def mod(other)
if other.is_a?(Number)
+ return Number.new(Float::NAN) if other.value == 0
operate(other, :%)
else
raise NoMethodError.new(nil, :mod)
end
end
@@ -470,10 +471,10 @@
return if unitless?
@numerator_units, @denominator_units =
sans_common_units(@numerator_units, @denominator_units)
@denominator_units.each_with_index do |d, i|
- next unless convertable?(d) && (u = @numerator_units.find(&method(:convertable?)))
+ next unless convertable?(d) && (u = @numerator_units.find {|n| convertable?([n, d])})
@value /= conversion_factor(d, u)
@denominator_units.delete_at(i)
@numerator_units.delete_at(@numerator_units.index(u))
end
end