lib/susy/sass_extensions.rb in compass-susy-plugin-0.7.0.pre7 vs lib/susy/sass_extensions.rb in compass-susy-plugin-0.7.0.pre8
- old
+ new
@@ -1,7 +1,15 @@
require 'sass'
+module Sass::Script
+ class Number < Literal
+ def ceil
+ Number.new(value.ceil, numerator_units, denominator_units)
+ end
+ end
+end
+
module Sass::Script::Functions
# some helpful constants
PERCENT = Sass::Script::Number.new(100, ["%"])
ONE = Sass::Script::Number.new(1)
@@ -25,19 +33,19 @@
if !n or !n.value
n = @@susy_total_columns
sg = @@susy_side_gutter_width
end
c, g = [@@susy_column_width, @@susy_gutter_width]
- n.times(c).plus(n.minus(ONE).times(g)).plus(sg.times(TWO))
+ n.times(c).plus(n.minus(ONE).ceil.times(g)).plus(sg.times(TWO))
end
# return the percentage width of 'n' columns in a context of
# 'context_columns'
def columns(n, context_columns = false)
raise Sass::SyntaxError, "container() must be called before columns() - should be called in susy/susy.sass" unless defined?(@@susy_column_width)
w = context(context_columns)
c, g = [@@susy_column_width, @@susy_gutter_width]
- n.times(c).plus(n.minus(ONE).times(g)).div(w).times(PERCENT)
+ n.times(c).plus(n.minus(ONE).ceil.times(g)).div(w).times(PERCENT)
end
# return the percentage width of a single gutter in a context of
# 'context_columns'
def gutter(context_columns = false)