Class: Sass::BaseEnvironment

### Home Classes Methods

### In Files

- lib/sass/environment.rb

### Parent

Object

### Methods

- ::inherited_hash_accessor
- ::inherited_hash_reader
- ::inherited_hash_writer
- ::new
- #caller
- #content
- #global?
- #global_env
- #selector
- #stack

### Class/Module Index

Quicksearch

- Sass
- Sass::BaseEnvironment
- Sass::CSS
- Sass::CacheStores
- Sass::CacheStores::Base
- Sass::CacheStores::Chain
- Sass::CacheStores::Filesystem
- Sass::CacheStores::Memory
- Sass::CacheStores::Null
- Sass::Callbacks
- Sass::Callbacks::InstanceMethods
- Sass::Engine
- Sass::Engine::Line
- Sass::Environment
- Sass::Exec
- Sass::Exec::Base
- Sass::Exec::SassConvert
- Sass::Exec::SassScss
- Sass::Exec::SassScss::Sass::Plugin.compiler
- Sass::Features
- Sass::Importers
- Sass::Importers::Base
- Sass::Importers::Filesystem
- Sass::Logger
- Sass::Logger::Base
- Sass::Logger::LogLevel
- Sass::Logger::LogLevel::ClassMethods
- Sass::Media
- Sass::Media::Query
- Sass::Media::QueryList
- Sass::Plugin
- Sass::Plugin::Compiler
- Sass::Plugin::Configuration
- Sass::Plugin::MerbBootLoader
- Sass::Plugin::Rack
- Sass::Plugin::StalenessChecker
- Sass::ReadOnlyEnvironment
- Sass::Repl
- Sass::SCSS
- Sass::SCSS::CssParser
- Sass::SCSS::Parser
- Sass::SCSS::RX
- Sass::SCSS::ScriptLexer
- Sass::SCSS::ScriptParser
- Sass::SCSS::StaticParser
- Sass::Script
- Sass::Script::CssLexer
- Sass::Script::CssParser
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::Lexer
- Sass::Script::Parser
- Sass::Script::Tree
- Sass::Script::Tree::Funcall
- Sass::Script::Tree::Interpolation
- Sass::Script::Tree::ListLiteral
- Sass::Script::Tree::Literal
- Sass::Script::Tree::MapLiteral
- Sass::Script::Tree::Node
- Sass::Script::Tree::Operation
- Sass::Script::Tree::Selector
- Sass::Script::Tree::StringInterpolation
- Sass::Script::Tree::UnaryOperation
- Sass::Script::Tree::Variable
- Sass::Script::Value
- Sass::Script::Value::ArgList
- Sass::Script::Value::Base
- Sass::Script::Value::Bool
- Sass::Script::Value::Color
- Sass::Script::Value::Helpers
- Sass::Script::Value::List
- Sass::Script::Value::Map
- Sass::Script::Value::Null
- Sass::Script::Value::Number
- Sass::Selector
- Sass::Selector::AbstractSequence
- Sass::Selector::Attribute
- Sass::Selector::Class
- Sass::Selector::CommaSequence
- Sass::Selector::Element
- Sass::Selector::Id
- Sass::Selector::Parent
- Sass::Selector::Placeholder
- Sass::Selector::Pseudo
- Sass::Selector::Sequence
- Sass::Selector::Simple
- Sass::Selector::SimpleSequence
- Sass::Selector::Universal
- Sass::SemiGlobalEnvironment
- Sass::Shared
- Sass::Source
- Sass::Source::Map
- Sass::Source::Map::Mapping
- Sass::Source::Position
- Sass::Source::Range
- Sass::Stack
- Sass::Stack::Frame
- Sass::Supports
- Sass::Supports::Condition
- Sass::Supports::Declaration
- Sass::Supports::Interpolation
- Sass::Supports::Negation
- Sass::Supports::Operator
- Sass::SyntaxError
- Sass::Tree
- Sass::Tree::AtRootNode
- Sass::Tree::CharsetNode
- Sass::Tree::CommentNode
- Sass::Tree::ContentNode
- Sass::Tree::CssImportNode
- Sass::Tree::DebugNode
- Sass::Tree::DirectiveNode
- Sass::Tree::EachNode
- Sass::Tree::ErrorNode
- Sass::Tree::ExtendNode
- Sass::Tree::ForNode
- Sass::Tree::FunctionNode
- Sass::Tree::IfNode
- Sass::Tree::ImportNode
- Sass::Tree::KeyframeRuleNode
- Sass::Tree::MediaNode
- Sass::Tree::MixinDefNode
- Sass::Tree::MixinNode
- Sass::Tree::Node
- Sass::Tree::PropNode
- Sass::Tree::ReturnNode
- Sass::Tree::RootNode
- Sass::Tree::RuleNode
- Sass::Tree::SupportsNode
- Sass::Tree::TraceNode
- Sass::Tree::VariableNode
- Sass::Tree::Visitors
- Sass::Tree::Visitors::Base
- Sass::Tree::Visitors::CheckNesting
- Sass::Tree::Visitors::Convert
- Sass::Tree::Visitors::Cssize
- Sass::Tree::Visitors::Cssize::Bubble
- Sass::Tree::Visitors::DeepCopy
- Sass::Tree::Visitors::Extend
- Sass::Tree::Visitors::Perform
- Sass::Tree::Visitors::SetOptions
- Sass::Tree::Visitors::ToCss
- Sass::Tree::WarnNode
- Sass::Tree::WhileNode
- Sass::UnitConversionError
- Sass::Util
- Sass::Util::CrossPlatformRandom
- Sass::Util::MultibyteStringScanner
- Sass::Util::NormalizedMap
- Sass::Util::SubsetMap
- Sass::Util::Test
- Sass::Version
- ActionController
- ActionController::Base
- Object
- OrderedHash

No matching classes.

# Sass::BaseEnvironment

The abstract base class for lexical environments for SassScript.

### Attributes

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

The options passed to the Sass Engine.

selector[W]

### Public Class Methods

inherited_hash_accessor(name) click to toggle source

Note: when updating this, update sass/yard/inherited_hash.rb as well.

    # File lib/sass/environment.rb, line 9
    def inherited_hash_accessor(name)
      inherited_hash_reader(name)
      inherited_hash_writer(name)
    end

inherited_hash_reader(name) click to toggle source

    # File lib/sass/environment.rb, line 14
    def inherited_hash_reader(name)
      class_eval           def #{name}(name)            _#{name}(name.tr('_', '-'))          end          def _#{name}(name)            (@#{name}s && @#{name}s[name]) || @parent && @parent._#{name}(name)          end          protected :_#{name}          def is_#{name}_global?(name)            return !@parent if @#{name}s && @#{name}s.has_key?(name)            @parent && @parent.is_#{name}_global?(name)          end, __FILE__, __LINE__ + 1
    end

inherited_hash_writer(name) click to toggle source

    # File lib/sass/environment.rb, line 32
    def inherited_hash_writer(name)
      class_eval           def set_#{name}(name, value)            name = name.tr('_', '-')            @#{name}s[name] = value unless try_set_#{name}(name, value)          end          def try_set_#{name}(name, value)            @#{name}s ||= {}            if @#{name}s.include?(name)              @#{name}s[name] = value              true            elsif @parent && !@parent.global?              @parent.try_set_#{name}(name, value)            else              false            end          end          protected :try_set_#{name}          def set_local_#{name}(name, value)            @#{name}s ||= {}            @#{name}s[name.tr('_', '-')] = value          end          def set_global_#{name}(name, value)            global_env.set_#{name}(name, value)          end, __FILE__, __LINE__ + 1
    end

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 86
    def initialize(parent = nil, options = nil)
      @parent = parent
      @options = options || (parent && parent.options) || {}
      @stack = Sass::Stack.new if @parent.nil?
    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 101
    def caller
      @caller || (@parent && @parent.caller)
    end

content() click to toggle source

The content passed to this environment. This is naturally only set for mixin body environments with content passed in.

@return {[Array<Sass::Tree::Node>, Environment]?} The content nodes and

    the lexical environment of the content block.

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

global?() click to toggle source

Returns whether this is the global environment.

@return [Boolean]

    # File lib/sass/environment.rb, line 95
    def global?
      @parent.nil?
    end

global_env() click to toggle source

The top-level Environment object.

@return [Environment]

    # File lib/sass/environment.rb, line 126
    def global_env
      @global_env ||= global? ? self : @parent.global_env
    end

selector() click to toggle source

The selector for the current CSS rule, or nil if there is no current CSS rule.

@return [Selector::CommaSequence?] The current selector, with any

    nesting fully resolved.

    # File lib/sass/environment.rb, line 119
    def selector
      @selector || (@caller && @caller.selector) || (@parent && @parent.selector)
    end

stack() click to toggle source

The import/mixin stack.

@return [Sass::Stack]

    # File lib/sass/environment.rb, line 133
    def stack
      @stack || global_env.stack
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.