Class Sass::Environment
In: lib/sass/environment.rb
Parent: Object

The lexical environment for SassScript. This keeps track of variable and mixin definitions.

A new environment is created for each level of Sass nesting. This allows variables to be lexically scoped. The new environment refers to the environment in the upper scope, so it has access to variables defined in enclosing scopes, but new variables are defined locally.

Environment also keeps track of the {Engine} options so that they can be made available to {Sass::Script::Functions}.

Methods

new   options  

Attributes

options  [W] 
parent  [R]  The enclosing environment, or nil if this is the global environment.

@return [Environment]

Public Class methods

@param parent [Environment] See \{parent}

[Source]

    # File lib/sass/environment.rb, line 22
22:     def initialize(parent = nil)
23:       @vars = {}
24:       @mixins = {}
25:       @parent = parent
26: 
27:       set_var("important", Script::String.new("!important")) unless @parent
28:     end

Public Instance methods

The options hash. See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.

@return [Hash<Symbol, Object>]

[Source]

    # File lib/sass/environment.rb, line 34
34:     def options
35:       @options || (parent && parent.options) || {}
36:     end

[Validate]