Class: Sass::Environment
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(parent = nil, options = nil) ⇒ Environment
constructor
A new instance of Environment.
- #options ⇒ Object
Constructor Details
#initialize(parent = nil, options = nil) ⇒ Environment
Returns a new instance of Environment.
5 6 7 8 9 10 |
# File 'lib/sass/environment.rb', line 5 def initialize(parent = nil, = nil) @vars = {} @mixins = {} @parent = parent @options = end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
3 4 5 |
# File 'lib/sass/environment.rb', line 3 def parent @parent end |
Class Method Details
.inherited_hash(name) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sass/environment.rb', line 16 def self.inherited_hash(name) class_eval <<RUBY, __FILE__, __LINE__ + 1 def #{name}(name) @#{name}s[name] || @parent && @parent.#{name}(name) end def set_#{name}(name, value) @#{name}s[name] = value unless try_set_#{name}(name, value) end def try_set_#{name}(name, value) if @#{name}s.include?(name) @#{name}s[name] = value true elsif @parent @parent.try_set_#{name}(name, value) else false end end protected :try_set_#{name} def set_local_#{name}(name, value) @#{name}s[name] = value end RUBY end |
Instance Method Details
#options ⇒ Object
12 13 14 |
# File 'lib/sass/environment.rb', line 12 def @options || (parent && parent.) || {} end |