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.

Methods

assert_type   new  

Included Modules

Sass::Script::Functions

Attributes

options  [R]  The options hash for the {Sass::Engine} that is processing the function call

@return [{Symbol => Object}]

Public Class methods

@param options [{Symbol => Object}] See \{options}

[Source]

     # File lib/sass/script/functions.rb, line 179
179:       def initialize(options)
180:         @options = options
181: 
182:         # We need to include this individually in each instance
183:         # because of an icky Ruby restriction
184:         class << self; include Sass::Script::Functions; end
185:       end

Public Instance methods

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`. Note that `:String` will match both double-quoted strings and unquoted identifiers.

@param value [Sass::Script::Literal] A SassScript value @param type [Symbol] The name of the type the value is expected to be

[Source]

     # File lib/sass/script/functions.rb, line 200
200:       def assert_type(value, type)
201:         return if value.is_a?(Sass::Script.const_get(type))
202:         raise ArgumentError.new("#{value.inspect} is not a #{type.to_s.downcase}")
203:       end

[Validate]