class Sass::ReadOnlyEnvironment
A read-only wrapper for a lexical environment for SassScript.
Public Class Methods
new(parent = nil, options = nil)
click to toggle source
Calls superclass method
Sass::BaseEnvironment::new
# File lib/sass/environment.rb, line 178 def initialize(parent = nil, options = nil) super @content_cached = nil end
Public Instance Methods
caller()
click to toggle source
The read-only environment of the caller of this environment’s mixin or function.
@see BaseEnvironment#caller
@return {ReadOnlyEnvironment}
Calls superclass method
Sass::BaseEnvironment#caller
# File lib/sass/environment.rb, line 186 def caller return @caller if @caller env = super @caller ||= env.is_a?(ReadOnlyEnvironment) ? env : ReadOnlyEnvironment.new(env, env.options) end
content()
click to toggle source
The content passed to this environment. If the content’s environment isn’t already read-only, it’s made read-only.
@return {[Array<Sass::Tree::Node>, ReadOnlyEnvironment]?} The content nodes and
the lexical environment of the content block. Returns `nil` when there is no content in this environment.
Calls superclass method
Sass::BaseEnvironment#content
# File lib/sass/environment.rb, line 200 def content # Return the cached content from a previous invocation if any return @content if @content_cached # get the content with a read-write environment from the superclass read_write_content = super if read_write_content tree, env = read_write_content # make the content's environment read-only if env && !env.is_a?(ReadOnlyEnvironment) env = ReadOnlyEnvironment.new(env, env.options) end @content_cached = true @content = [tree, env] else @content_cached = true @content = nil end end