haml 3.1.0.alpha.19 → 3.1.0.alpha.22

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

Files changed (33) hide show
  1. data/EDGE_GEM_VERSION +1 -1
  2. data/VERSION +1 -1
  3. data/lib/haml/precompiler.rb +1 -0
  4. data/lib/haml/template/plugin.rb +16 -6
  5. data/vendor/sass/doc-src/SASS_CHANGELOG.md +41 -0
  6. data/vendor/sass/doc-src/SASS_REFERENCE.md +37 -6
  7. data/vendor/sass/lib/sass.rb +7 -3
  8. data/vendor/sass/lib/sass/engine.rb +4 -4
  9. data/vendor/sass/lib/sass/environment.rb +24 -15
  10. data/vendor/sass/lib/sass/less.rb +31 -12
  11. data/vendor/sass/lib/sass/plugin/staleness_checker.rb +1 -1
  12. data/vendor/sass/lib/sass/script/funcall.rb +51 -9
  13. data/vendor/sass/lib/sass/script/functions.rb +189 -57
  14. data/vendor/sass/lib/sass/script/node.rb +7 -1
  15. data/vendor/sass/lib/sass/script/number.rb +21 -15
  16. data/vendor/sass/lib/sass/script/operation.rb +10 -5
  17. data/vendor/sass/lib/sass/script/parser.rb +61 -17
  18. data/vendor/sass/lib/sass/script/string.rb +2 -3
  19. data/vendor/sass/lib/sass/script/variable.rb +6 -0
  20. data/vendor/sass/lib/sass/scss/parser.rb +8 -5
  21. data/vendor/sass/lib/sass/selector/sequence.rb +2 -2
  22. data/vendor/sass/lib/sass/tree/mixin_node.rb +25 -5
  23. data/vendor/sass/lib/sass/tree/node.rb +2 -2
  24. data/vendor/sass/lib/sass/tree/prop_node.rb +9 -6
  25. data/vendor/sass/lib/sass/tree/rule_node.rb +9 -8
  26. data/vendor/sass/lib/sass/util.rb +5 -3
  27. data/vendor/sass/test/sass/conversion_test.rb +14 -0
  28. data/vendor/sass/test/sass/engine_test.rb +85 -0
  29. data/vendor/sass/test/sass/functions_test.rb +89 -0
  30. data/vendor/sass/test/sass/less_conversion_test.rb +24 -3
  31. data/vendor/sass/test/sass/script_conversion_test.rb +65 -0
  32. data/vendor/sass/test/sass/scss/scss_test.rb +63 -0
  33. metadata +2 -2
@@ -8,122 +8,125 @@ module Sass::Script
8
8
  #
9
9
  # The following functions are provided:
10
10
  #
11
+ # *Note: These functions are described in more detail below.*
12
+ #
11
13
  # ## RGB Functions
12
14
  #
13
- # \{#rgb}
15
+ # \{#rgb rgb($red, $green, $blue)}
14
16
  # : Converts an `rgb(red, green, blue)` triplet into a color.
15
17
  #
16
- # \{#rgba}
18
+ # \{#rgba rgba($red, $green, $blue, $alpha)}
17
19
  # : Converts an `rgba(red, green, blue, alpha)` quadruplet into a color.
18
20
  #
19
- # \{#red}
21
+ # \{#rgba rgba($color, $alpha)}
22
+ # : Adds an alpha layer to any color value.
23
+ #
24
+ # \{#red red($color)}
20
25
  # : Gets the red component of a color.
21
26
  #
22
- # \{#green}
27
+ # \{#green green($color)}
23
28
  # : Gets the green component of a color.
24
29
  #
25
- # \{#blue}
30
+ # \{#blue blue($color)}
26
31
  # : Gets the blue component of a color.
27
32
  #
28
- # \{#mix}
33
+ # \{#mix mix($color-1, $color-2, \[$weight\])}
29
34
  # : Mixes two colors together.
30
35
  #
31
36
  # ## HSL Functions
32
37
  #
33
- # \{#hsl}
38
+ # \{#hsl hsl($hue, $saturation, $lightness)}
34
39
  # : Converts an `hsl(hue, saturation, lightness)` triplet into a color.
35
40
  #
36
- # \{#hsla}
41
+ # \{#hsla hsla($hue, $saturation, $lightness, $alpha)}
37
42
  # : Converts an `hsla(hue, saturation, lightness, alpha)` quadruplet into a color.
38
43
  #
39
- # \{#hue}
44
+ # \{#hue hue($color)}
40
45
  # : Gets the hue component of a color.
41
46
  #
42
- # \{#saturation}
47
+ # \{#saturation saturation($color)}
43
48
  # : Gets the saturation component of a color.
44
49
  #
45
- # \{#lightness}
50
+ # \{#lightness lightness($color)}
46
51
  # : Gets the lightness component of a color.
47
52
  #
48
- # \{#adjust_hue #adjust-hue}
53
+ # \{#adjust_hue adjust-hue($color, $degrees)}
49
54
  # : Changes the hue of a color.
50
55
  #
51
- # \{#lighten}
56
+ # \{#lighten lighten($color, $amount)}
52
57
  # : Makes a color lighter.
53
58
  #
54
- # \{#darken}
59
+ # \{#darken darken($color, $amount)}
55
60
  # : Makes a color darker.
56
61
  #
57
- # \{#saturate}
62
+ # \{#saturate saturate($color, $amount)}
58
63
  # : Makes a color more saturated.
59
64
  #
60
- # \{#desaturate}
65
+ # \{#desaturate desaturate($color, $amount)}
61
66
  # : Makes a color less saturated.
62
67
  #
63
- # \{#grayscale}
68
+ # \{#grayscale grayscale($color)}
64
69
  # : Converts a color to grayscale.
65
70
  #
66
- # \{#complement}
71
+ # \{#complement complement($color)}
67
72
  # : Returns the complement of a color.
68
73
  #
69
- # \{#invert}
74
+ # \{#invert invert($color)}
70
75
  # : Returns the inverse of a color.
71
76
  #
72
77
  # ## Opacity Functions
73
78
  #
74
- # \{#alpha} / \{#opacity}
79
+ # \{#alpha alpha($color)} / \{#opacity opacity($color)}
75
80
  # : Gets the alpha component (opacity) of a color.
76
81
  #
77
- # \{#rgba}
78
- # : Sets the alpha component of a color.
82
+ # \{#rgba rgba($color, $alpha)}
83
+ # : Add or change an alpha layer for any color value.
79
84
  #
80
- # \{#opacify} / \{#fade_in #fade-in}
85
+ # \{#opacify opacify($color, $amount)} / \{#fade_in fade-in($color, $amount)}
81
86
  # : Makes a color more opaque.
82
87
  #
83
- # \{#transparentize} / \{#fade_out #fade-out}
88
+ # \{#transparentize transparentize($color, $amount)} / \{#fade_out fade-out($color, $amount)}
84
89
  # : Makes a color more transparent.
85
90
  #
86
91
  # ## String Functions
87
92
  #
88
- # \{#unquote}
93
+ # \{#unquote unquote($string)}
89
94
  # : Removes the quotes from a string.
90
95
  #
91
- # \{#quote}
96
+ # \{#quote quote($string)}
92
97
  # : Adds quotes to a string.
93
98
  #
94
99
  # ## Number Functions
95
100
  #
96
- # \{#percentage}
101
+ # \{#percentage percentage($value)}
97
102
  # : Converts a unitless number to a percentage.
98
103
  #
99
- # \{#round}
104
+ # \{#round round($value)}
100
105
  # : Rounds a number to the nearest whole number.
101
106
  #
102
- # \{#ceil}
107
+ # \{#ceil ceil($value)}
103
108
  # : Rounds a number up to the nearest whole number.
104
109
  #
105
- # \{#floor}
110
+ # \{#floor floor($value)}
106
111
  # : Rounds a number down to the nearest whole number.
107
112
  #
108
- # \{#abs}
113
+ # \{#abs abs($value)}
109
114
  # : Returns the absolute value of a number.
110
115
  #
111
116
  # ## Introspection Functions
112
117
  #
113
- # \{#type_of}
118
+ # \{#type_of type-of($value)}
114
119
  # : Returns the type of a value.
115
120
  #
116
- # \{#unit}
121
+ # \{#unit unit($number)}
117
122
  # : Returns the units associated with a number.
118
123
  #
119
- # \{#unitless}
124
+ # \{#unitless unitless($number)}
120
125
  # : Returns whether a number has units or not.
121
126
  #
122
- # \{#comparable}
127
+ # \{#comparable comparable($number-1, $number-2)}
123
128
  # : Returns whether two numbers can be added or compared.
124
129
  #
125
- # These functions are described in more detail below.
126
- #
127
130
  # ## Adding Custom Functions
128
131
  #
129
132
  # New Sass functions can be added by adding Ruby methods to this module.
@@ -134,8 +137,13 @@ module Sass::Script
134
137
  # assert_type string, :String
135
138
  # Sass::Script::String.new(string.value.reverse)
136
139
  # end
140
+ # declare :reverse, :args => [:string]
137
141
  # end
138
142
  #
143
+ # Calling {declare} tells Sass the argument names for your function.
144
+ # If omitted, the function will still work, but will not be able to accept keyword arguments.
145
+ # {declare} can also allow your function to take arbitrary keyword arguments.
146
+ #
139
147
  # There are a few things to keep in mind when modifying this module.
140
148
  # First of all, the arguments passed are {Sass::Script::Literal} objects.
141
149
  # Literal objects are also expected to be returned.
@@ -169,6 +177,91 @@ module Sass::Script
169
177
  # (or other methods that use the string representation)
170
178
  # on those objects without first setting {Node#options= the #options attribute}.
171
179
  module Functions
180
+ @signatures = {}
181
+
182
+ # A class representing a Sass function signature.
183
+ #
184
+ # @attr args [Array<Symbol>] The names of the arguments to the function.
185
+ # @attr var_args [Boolean] Whether the function takes a variable number of arguments.
186
+ # @attr var_kwargs [Boolean] Whether the function takes an arbitrary set of keyword arguments.
187
+ Signature = Struct.new(:args, :var_args, :var_kwargs)
188
+
189
+ # Declare a Sass signature for a Ruby-defined function.
190
+ # This includes the names of the arguments,
191
+ # whether the function takes a variable number of arguments,
192
+ # and whether the function takes an arbitrary set of keyword arguments.
193
+ #
194
+ # It's not necessary to declare a signature for a function.
195
+ # However, without a signature it won't support keyword arguments.
196
+ #
197
+ # A single function can have multiple signatures declared
198
+ # as long as each one takes a different number of arguments.
199
+ # It's also possible to declare multiple signatures
200
+ # that all take the same number of arguments,
201
+ # but none of them but the first will be used
202
+ # unless the user uses keyword arguments.
203
+ #
204
+ # @param method_name [Symbol] The name of the method
205
+ # whose signature is being declared.
206
+ # @param args [Array<Symbol>] The names of the arguments for the function signature.
207
+ # @option options :var_args [Boolean] (false)
208
+ # Whether the function accepts a variable number of (unnamed) arguments
209
+ # in addition to the named arguments.
210
+ # @option options :var_kwargs [Boolean] (false)
211
+ # Whether the function accepts other keyword arguments
212
+ # in addition to those in `:args`.
213
+ # If this is true, the Ruby function will be passed a hash from strings
214
+ # to {Sass::Script::Literal}s as the last argument.
215
+ #
216
+ # @example
217
+ # declare :rgba, [:hex, :alpha]
218
+ # declare :rgba, [:red, :green, :blue, :alpha]
219
+ # declare :accepts_anything, [], :var_args => true, :var_kwargs => true
220
+ # declare :some_func, [:foo, :bar, :baz], :var_kwargs => true
221
+ def self.declare(method_name, args, options = {})
222
+ @signatures[method_name] ||= []
223
+ @signatures[method_name] << Signature.new(
224
+ args.map {|s| s.to_s},
225
+ options[:var_args],
226
+ options[:var_kwargs])
227
+ end
228
+
229
+ # Determine the correct signature for the number of arguments
230
+ # passed in for a given function.
231
+ # If no signatures match, the first signature is returned for error messaging.
232
+ #
233
+ # @param method_name [Symbol] The name of the Ruby function to be called.
234
+ # @param arg_arity [Number] The number of unnamed arguments the function was passed.
235
+ # @param kwarg_arity [Number] The number of keyword arguments the function was passed.
236
+ #
237
+ # @return [{Symbol => Object}, nil]
238
+ # The signature options for the matching signature,
239
+ # or nil if no signatures are declared for this function. See {declare}.
240
+ def self.signature(method_name, arg_arity, kwarg_arity)
241
+ return unless @signatures[method_name]
242
+ @signatures[method_name].each do |signature|
243
+ return signature if signature.args.size == arg_arity + kwarg_arity
244
+ next unless signature.args.size < arg_arity + kwarg_arity
245
+
246
+ # We have enough args.
247
+ # Now we need to figure out which args are varargs
248
+ # and if the signature allows them.
249
+ t_arg_arity, t_kwarg_arity = arg_arity, kwarg_arity
250
+ if signature.args.size > t_arg_arity
251
+ # we transfer some kwargs arity to args arity
252
+ # if it does not have enough args -- assuming the names will work out.
253
+ t_kwarg_arity -= (signature.args.size - t_arg_arity)
254
+ t_arg_arity = signature.args.size
255
+ end
256
+
257
+ if ( t_arg_arity == signature.args.size || t_arg_arity > signature.args.size && signature.var_args ) &&
258
+ (t_kwarg_arity == 0 || t_kwarg_arity > 0 && signature.var_kwargs)
259
+ return signature
260
+ end
261
+ end
262
+ @signatures[method_name].first
263
+ end
264
+
172
265
  # The context in which methods in {Script::Functions} are evaluated.
173
266
  # That means that all instance methods of {EvaluationContext}
174
267
  # are available to use in functions.
@@ -237,6 +330,7 @@ module Sass::Script
237
330
  end
238
331
  end)
239
332
  end
333
+ declare :rgb, [:red, :green, :blue]
240
334
 
241
335
  # @see #rgb
242
336
  # @overload rgba(red, green, blue, alpha)
@@ -284,6 +378,8 @@ module Sass::Script
284
378
  raise ArgumentError.new("wrong number of arguments (#{args.size} for 4)")
285
379
  end
286
380
  end
381
+ declare :rgba, [:red, :green, :blue, :alpha]
382
+ declare :rgba, [:color, :alpha]
287
383
 
288
384
  # Creates a {Color} object from hue, saturation, and lightness.
289
385
  # Uses the algorithm from the [CSS3 spec](http://www.w3.org/TR/css3-color/#hsl-color).
@@ -300,6 +396,7 @@ module Sass::Script
300
396
  def hsl(hue, saturation, lightness)
301
397
  hsla(hue, saturation, lightness, Number.new(1))
302
398
  end
399
+ declare :hsl, [:hue, :saturation, :lightness]
303
400
 
304
401
  # Creates a {Color} object from hue, saturation, and lightness,
305
402
  # as well as an alpha channel indicating opacity.
@@ -335,6 +432,7 @@ module Sass::Script
335
432
 
336
433
  Color.new(:hue => h, :saturation => s, :lightness => l, :alpha => alpha.value)
337
434
  end
435
+ declare :hsla, [:hue, :saturation, :lightness, :alpha]
338
436
 
339
437
  # Returns the red component of a color.
340
438
  #
@@ -345,6 +443,7 @@ module Sass::Script
345
443
  assert_type color, :Color
346
444
  Sass::Script::Number.new(color.red)
347
445
  end
446
+ declare :red, [:color]
348
447
 
349
448
  # Returns the green component of a color.
350
449
  #
@@ -355,6 +454,7 @@ module Sass::Script
355
454
  assert_type color, :Color
356
455
  Sass::Script::Number.new(color.green)
357
456
  end
457
+ declare :green, [:color]
358
458
 
359
459
  # Returns the blue component of a color.
360
460
  #
@@ -365,6 +465,7 @@ module Sass::Script
365
465
  assert_type color, :Color
366
466
  Sass::Script::Number.new(color.blue)
367
467
  end
468
+ declare :blue, [:color]
368
469
 
369
470
  # Returns the hue component of a color.
370
471
  #
@@ -380,6 +481,7 @@ module Sass::Script
380
481
  assert_type color, :Color
381
482
  Sass::Script::Number.new(color.hue, ["deg"])
382
483
  end
484
+ declare :hue, [:color]
383
485
 
384
486
  # Returns the saturation component of a color.
385
487
  #
@@ -396,6 +498,7 @@ module Sass::Script
396
498
  assert_type color, :Color
397
499
  Sass::Script::Number.new(color.saturation, ["%"])
398
500
  end
501
+ declare :saturation, [:color]
399
502
 
400
503
  # Returns the hue component of a color.
401
504
  #
@@ -412,6 +515,7 @@ module Sass::Script
412
515
  assert_type color, :Color
413
516
  Sass::Script::Number.new(color.lightness, ["%"])
414
517
  end
518
+ declare :lightness, [:color]
415
519
 
416
520
  # Returns the alpha component (opacity) of a color.
417
521
  # This is 1 unless otherwise specified.
@@ -436,6 +540,7 @@ module Sass::Script
436
540
 
437
541
  opacity(*args)
438
542
  end
543
+ declare :alpha, [:color]
439
544
 
440
545
  # Returns the alpha component (opacity) of a color.
441
546
  # This is 1 unless otherwise specified.
@@ -449,6 +554,7 @@ module Sass::Script
449
554
  assert_type color, :Color
450
555
  Sass::Script::Number.new(color.alpha)
451
556
  end
557
+ declare :opacity, [:color]
452
558
 
453
559
  # Makes a color more opaque.
454
560
  # Takes a color and an amount between 0 and 1,
@@ -466,7 +572,10 @@ module Sass::Script
466
572
  def opacify(color, amount)
467
573
  adjust(color, amount, :alpha, 0..1, :+)
468
574
  end
575
+ declare :opacify, [:color, :amount]
576
+
469
577
  alias_method :fade_in, :opacify
578
+ declare :fade_in, [:color, :amount]
470
579
 
471
580
  # Makes a color more transparent.
472
581
  # Takes a color and an amount between 0 and 1,
@@ -484,7 +593,10 @@ module Sass::Script
484
593
  def transparentize(color, amount)
485
594
  adjust(color, amount, :alpha, 0..1, :-)
486
595
  end
596
+ declare :transparentize, [:color, :amount]
597
+
487
598
  alias_method :fade_out, :transparentize
599
+ declare :fade_out, [:color, :amount]
488
600
 
489
601
  # Makes a color lighter.
490
602
  # Takes a color and an amount between 0% and 100%,
@@ -502,6 +614,7 @@ module Sass::Script
502
614
  def lighten(color, amount)
503
615
  adjust(color, amount, :lightness, 0..100, :+, "%")
504
616
  end
617
+ declare :lighten, [:color, :amount]
505
618
 
506
619
  # Makes a color darker.
507
620
  # Takes a color and an amount between 0% and 100%,
@@ -519,6 +632,7 @@ module Sass::Script
519
632
  def darken(color, amount)
520
633
  adjust(color, amount, :lightness, 0..100, :-, "%")
521
634
  end
635
+ declare :darken, [:color, :amount]
522
636
 
523
637
  # Makes a color more saturated.
524
638
  # Takes a color and an amount between 0% and 100%,
@@ -536,6 +650,7 @@ module Sass::Script
536
650
  def saturate(color, amount)
537
651
  adjust(color, amount, :saturation, 0..100, :+, "%")
538
652
  end
653
+ declare :saturate, [:color, :amount]
539
654
 
540
655
  # Makes a color less saturated.
541
656
  # Takes a color and an amount between 0% and 100%,
@@ -553,6 +668,7 @@ module Sass::Script
553
668
  def desaturate(color, amount)
554
669
  adjust(color, amount, :saturation, 0..100, :-, "%")
555
670
  end
671
+ declare :desaturate, [:color, :amount]
556
672
 
557
673
  # Changes the hue of a color while retaining the lightness and saturation.
558
674
  # Takes a color and a number of degrees (usually between -360deg and 360deg),
@@ -571,6 +687,7 @@ module Sass::Script
571
687
  assert_type degrees, :Number
572
688
  color.with(:hue => color.hue + degrees.value)
573
689
  end
690
+ declare :adjust_hue, [:color, :degrees]
574
691
 
575
692
  # Mixes together two colors.
576
693
  # Specifically, takes the average of each of the RGB components,
@@ -635,6 +752,8 @@ module Sass::Script
635
752
  alpha = color1.alpha*p + color2.alpha*(1-p)
636
753
  Color.new(rgb + [alpha])
637
754
  end
755
+ declare :mix, [:color_1, :color_2]
756
+ declare :mix, [:color_1, :color_2, :weight]
638
757
 
639
758
  # Converts a color to grayscale.
640
759
  # This is identical to `desaturate(color, 100%)`.
@@ -646,6 +765,7 @@ module Sass::Script
646
765
  def grayscale(color)
647
766
  desaturate color, Number.new(100)
648
767
  end
768
+ declare :grayscale, [:color]
649
769
 
650
770
  # Returns the complement of a color.
651
771
  # This is identical to `adjust-hue(color, 180deg)`.
@@ -657,6 +777,7 @@ module Sass::Script
657
777
  def complement(color)
658
778
  adjust_hue color, Number.new(180)
659
779
  end
780
+ declare :complement, [:color]
660
781
 
661
782
  # Returns the inverse (negative) of a color.
662
783
  # The red, green, and blue values are inverted, while the opacity is left alone.
@@ -675,32 +796,34 @@ module Sass::Script
675
796
  # Removes quotes from a string if the string is quoted,
676
797
  # or returns the same string if it's not.
677
798
  #
678
- # @param str [String]
799
+ # @param string [String]
679
800
  # @return [String]
680
- # @raise [ArgumentError] if `str` isn't a string
801
+ # @raise [ArgumentError] if `string` isn't a string
681
802
  # @see #quote
682
803
  # @example
683
804
  # unquote("foo") => foo
684
805
  # unquote(foo) => foo
685
- def unquote(str)
686
- assert_type str, :String
687
- Sass::Script::String.new(str.value, :identifier)
806
+ def unquote(string)
807
+ assert_type string, :String
808
+ Sass::Script::String.new(string.value, :identifier)
688
809
  end
810
+ declare :unquote, [:string]
689
811
 
690
812
  # Add quotes to a string if the string isn't quoted,
691
813
  # or returns the same string if it is.
692
814
  #
693
- # @param str [String]
815
+ # @param string [String]
694
816
  # @return [String]
695
- # @raise [ArgumentError] if `str` isn't a string
817
+ # @raise [ArgumentError] if `string` isn't a string
696
818
  # @see #unquote
697
819
  # @example
698
820
  # quote("foo") => "foo"
699
821
  # quote(foo) => "foo"
700
- def quote(str)
701
- assert_type str, :String
702
- Sass::Script::String.new(str.value, :string)
822
+ def quote(string)
823
+ assert_type string, :String
824
+ Sass::Script::String.new(string.value, :string)
703
825
  end
826
+ declare :quote, [:string]
704
827
 
705
828
  # Inspects the type of the argument, returning it as an unquoted string.
706
829
  #
@@ -711,11 +834,12 @@ module Sass::Script
711
834
  # type-of(true) => bool
712
835
  # type-of(#fff) => color
713
836
  # type-of(blue) => color
714
- # @param obj [Literal] The object to inspect
837
+ # @param value [Literal] The object to inspect
715
838
  # @return [String] The unquoted string name of the literal's type
716
- def type_of(obj)
717
- Sass::Script::String.new(obj.class.name.gsub(/Sass::Script::/,'').downcase)
839
+ def type_of(value)
840
+ Sass::Script::String.new(value.class.name.gsub(/Sass::Script::/,'').downcase)
718
841
  end
842
+ declare :type_of, [:value]
719
843
 
720
844
  # Inspects the unit of the number, returning it as a quoted string.
721
845
  # Complex units are sorted in alphabetical order by numerator and denominator.
@@ -733,6 +857,7 @@ module Sass::Script
733
857
  assert_type number, :Number
734
858
  Sass::Script::String.new(number.unit_str, :string)
735
859
  end
860
+ declare :unit, [:number]
736
861
 
737
862
  # Inspects the unit of the number, returning a boolean indicating if it is unitless.
738
863
  #
@@ -746,6 +871,7 @@ module Sass::Script
746
871
  assert_type number, :Number
747
872
  Sass::Script::Bool.new(number.unitless?)
748
873
  end
874
+ declare :unitless, [:number]
749
875
 
750
876
  # Returns true if two numbers are similar enough to be added, subtracted, or compared.
751
877
  #
@@ -753,15 +879,16 @@ module Sass::Script
753
879
  # comparable(2px, 1px) => true
754
880
  # comparable(100px, 3em) => false
755
881
  # comparable(10cm, 3mm) => true
756
- # @param number1 [Number]
757
- # @param number2 [Number]
882
+ # @param number_1 [Number]
883
+ # @param number_2 [Number]
758
884
  # @return [Bool] indicating if the numbers can be compared.
759
- # @raise [ArgumentError] if `number1` or `number2` aren't numbers
760
- def comparable(number1, number2)
761
- assert_type number1, :Number
762
- assert_type number2, :Number
763
- Sass::Script::Bool.new(number1.comparable_to?(number2))
885
+ # @raise [ArgumentError] if `number_1` or `number_2` aren't numbers
886
+ def comparable(number_1, number_2)
887
+ assert_type number_1, :Number
888
+ assert_type number_2, :Number
889
+ Sass::Script::Bool.new(number_1.comparable_to?(number_2))
764
890
  end
891
+ declare :comparable, [:number_1, :number_2]
765
892
 
766
893
  # Converts a decimal number to a percentage.
767
894
  #
@@ -776,6 +903,7 @@ module Sass::Script
776
903
  end
777
904
  Sass::Script::Number.new(value.value * 100, ['%'])
778
905
  end
906
+ declare :percentage, [:value]
779
907
 
780
908
  # Rounds a number to the nearest whole number.
781
909
  #
@@ -788,6 +916,7 @@ module Sass::Script
788
916
  def round(value)
789
917
  numeric_transformation(value) {|n| n.round}
790
918
  end
919
+ declare :round, [:value]
791
920
 
792
921
  # Rounds a number up to the nearest whole number.
793
922
  #
@@ -800,6 +929,7 @@ module Sass::Script
800
929
  def ceil(value)
801
930
  numeric_transformation(value) {|n| n.ceil}
802
931
  end
932
+ declare :ceil, [:value]
803
933
 
804
934
  # Rounds down to the nearest whole number.
805
935
  #
@@ -812,6 +942,7 @@ module Sass::Script
812
942
  def floor(value)
813
943
  numeric_transformation(value) {|n| n.floor}
814
944
  end
945
+ declare :floor, [:value]
815
946
 
816
947
  # Finds the absolute value of a number.
817
948
  #
@@ -824,6 +955,7 @@ module Sass::Script
824
955
  def abs(value)
825
956
  numeric_transformation(value) {|n| n.abs}
826
957
  end
958
+ declare :abs, [:value]
827
959
 
828
960
  private
829
961