Class: Sass::SemiGlobalEnvironment

Inherits:
Environment show all
Defined in:
lib/sass/environment.rb

Overview

An environment that can write to in-scope global variables, but doesn't create new variables in the global scope. Useful for top-level control directives.

Instance Attribute Summary

Attributes inherited from Environment

#parent

Attributes inherited from BaseEnvironment

#caller, #content, #options, #selector

Instance Method Summary collapse

Methods inherited from BaseEnvironment

#global?, #global_env, inherited_hash_accessor, inherited_hash_reader, inherited_hash_writer, #initialize, #stack

Constructor Details

This class inherits a constructor from Sass::BaseEnvironment

Instance Method Details

#try_set_var(name, value)



224
225
226
227
228
229
230
231
232
233
234
# File 'lib/sass/environment.rb', line 224

def try_set_var(name, value)
  @vars ||= {}
  if @vars.include?(name)
    @vars[name] = value
    true
  elsif @parent
    @parent.try_set_var(name, value)
  else
    false
  end
end