Class | Sass::Script::Functions::EvaluationContext |
In: |
lib/sass/script/functions.rb
|
Parent: | Object |
The context in which methods in {Script::Functions} are evaluated. That means that all instance methods of {EvaluationContext} are available to use in functions.
options | [R] |
The options hash for the {Sass::Engine}
that is processing the function call
@return [{Symbol => Object}] |
@param options [{Symbol => Object}] See \{options}
# File lib/sass/script/functions.rb, line 81 81: def initialize(options) 82: @options = options 83: 84: # We need to include this individually in each instance 85: # because of an icky Ruby restriction 86: class << self; include Sass::Script::Functions; end 87: end
Asserts that the type of a given SassScript value is the expected type (designated by a symbol). For example:
assert_type value, :String assert_type value, :Number
Valid types are `:Bool`, `:Color`, `:Number`, and `:String`.
@param value [Sass::Script::Literal] A SassScript value @param type [Symbol] The name of the type the value is expected to be
# File lib/sass/script/functions.rb, line 100 100: def assert_type(value, type) 101: return if value.is_a?(Sass::Script.const_get(type)) 102: raise ArgumentError.new("#{value.inspect} is not a #{type.to_s.downcase}") 103: end