class Sass::Environment

The lexical environment for SassScript. This keeps track of variable, mixin, and function 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}.

Constants

DASH

Attributes

caller[W]
content[W]
options[R]
parent[R]

The enclosing environment, or nil if this is the global environment.

@return [Environment]

Public Class Methods

new(parent = nil, options = nil) click to toggle source

@param options [{Symbol => Object}] The options hash. See

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

@param parent [Environment] See {#parent}

# File lib/sass/environment.rb, line 28
def initialize(parent = nil, options = nil)
  @parent = parent
  @options = options || (parent && parent.options) || {}
end

Public Instance Methods

caller() click to toggle source

The environment of the caller of this environment's mixin or function. @return {Environment?}

# File lib/sass/environment.rb, line 35
def caller
  @caller || (@parent && @parent.caller)
end
content() click to toggle source

The content passed to this environmnet. This is naturally only set for mixin body environments with content passed in. @return {Environment?}

# File lib/sass/environment.rb, line 42
def content
  @content || (@parent && @parent.content)
end