Class: Sass::Script::Functions::EvaluationContext
- Inherits:
-
Object
- Object
- Sass::Script::Functions::EvaluationContext
- Includes:
- Defined in:
- /var/www/sass-pages/.sass/lib/sass/script/functions.rb
Overview
The context in which methods in Script::Functions are evaluated. That means that all instance methods of EvaluationContext are available to use in functions.
Instance Attribute Summary
- - ({Symbol => Object}) options readonly The options hash for the Sass::Engine that is processing the function call.
Instance Method Summary
- - assert_type(value, type, name = nil) Asserts that the type of a given SassScript value is the expected type (designated by a symbol).
- - (EvaluationContext) initialize(options) constructor A new instance of EvaluationContext.
Methods included from
#abs, #adjust_color, #adjust_hue, #alpha, #append, #blue, #ceil, #change_color, #comparable, #complement, #counter, #darken, declare, #desaturate, #floor, #grayscale, #green, #hsl, #hsla, #hue, #ie_hex_str, #if, #index, #invert, #join, #length, #lighten, #lightness, #max, #min, #mix, #nth, #opacify, #opacity, #percentage, #quote, #red, #rgb, #rgba, #round, #saturate, #saturation, #scale_color, signature, #transparentize, #type_of, #unit, #unitless, #unquote, #zip
Constructor Details
- (EvaluationContext) initialize(options)
A new instance of EvaluationContext
324 325 326 |
# File '/var/www/sass-pages/.sass/lib/sass/script/functions.rb', line 324
def initialize(options)
@options = options
end
|
Instance Attribute Details
- ({Symbol => Object}) options (readonly)
The options hash for the Sass::Engine that is processing the function call
321 322 323 |
# File '/var/www/sass-pages/.sass/lib/sass/script/functions.rb', line 321
def options
@options
end
|
Instance Method Details
- assert_type(value, type, name = nil)
Asserts that the type of a given SassScript value is the expected type (designated by a symbol).
Valid types are :Bool, :Color, :Number, and :String. Note that :String will match both double-quoted strings and unquoted identifiers.
341 342 343 344 345 346 |
# File '/var/www/sass-pages/.sass/lib/sass/script/functions.rb', line 341
def assert_type(value, type, name = nil)
return if value.is_a?(Sass::Script.const_get(type))
err = "#{value.inspect} is not a #{type.to_s.downcase}"
err = "$#{name}: " + err if name
raise ArgumentError.new(err)
end
|