class Sass::Tree::Node

The abstract superclass of all parse-tree nodes.

def <<(child)

Raises:
  • (Sass::SyntaxError) - if `child` is invalid

Parameters:
  • child (Tree::Node, Array) -- The child node or nodes
def <<(child)
  return if child.nil?
  if child.is_a?(Array)
    child.each {|c| self << c}
  else
    self.has_children = true
    @children << child
  end
end

def ==(other)

Other tags:
    See: Sass::Tree -

Returns:
  • (Boolean) - Whether or not this node and the other object

Parameters:
  • other (Object) -- The object to compare with
def ==(other)
  self.class == other.class && other.children == children
end

def after_sass_cache_store(o)

def after_sass_cache_store(o)
  self.options = o
end

def balance(*args)

Raises:
  • (Sass::SyntaxError) - if the brackets aren't balanced

Other tags:
    See: Sass::Shared.balance -
def balance(*args)
  res = Sass::Shared.balance(*args)
  return res if res
  raise Sass::SyntaxError.new("Unbalanced brackets.", :line => line)
end

def before_sass_cache_store

def before_sass_cache_store
  o = self.options
  self.options = {}
  return o
end

def children=(children)

Other tags:
    Private: -
def children=(children)
  self.has_children ||= !children.empty?
  @children = children
end

def deep_copy

Returns:
  • (Node) -
def deep_copy
  node = dup
  node.children = children.map {|c| c.deep_copy}
  node
end

def do_extend(extends)

Raises:
  • (Sass::SyntaxError) - Only if there's a programmer error

Returns:
  • (Tree::Node) - The resulting tree of static CSS nodes.

Parameters:
  • extends (Sass::Util::SubsetMap{Selector::Simple => Selector::Sequence}) --

Other tags:
    Todo: - Link this to the reference documentation on `@extend`
def do_extend(extends)
  node = dup
  node.children = children.map {|c| c.do_extend(extends)}
  node
rescue Sass::SyntaxError => e
  e.modify_backtrace(:filename => filename, :line => line)
  raise e
end

def each(&block)

Other tags:
    Yieldparam: node - a node in the tree

Other tags:
    Yield: - node
def each(&block)
  yield self
  children.each {|c| c.each(&block)}
end

def filename

Returns:
  • (String) -
def filename
  @filename || (@options && @options[:filename])
end

def initialize

def initialize
  @children = []
end

def invisible?; false; end

Returns:
  • (Boolean) -
def invisible?; false; end

def options=(options)

Other tags:
    See: #options -

Parameters:
  • options ({Symbol => Object}) -- The options
def options=(options)
  children.each {|c| c.options = options}
  if respond_to?(:subnodes)
    subnodes.each {|n| n.options = options if n.respond_to?(:options=)}
  end
  @options = options
end

def style

Returns:
  • (Symbol) -
def style
  @options[:style]
end

def to_s

Other tags:
    See: Sass::Tree -

Returns:
  • (String, nil) - The resulting CSS
def to_s
  Sass::Tree::Visitors::ToCss.visit(self)
end

def to_sass(options = {})

Returns:
  • (String) - The Sass code corresponding to the node

Parameters:
  • options ({Symbol => Object}) -- An options hash (see {Sass::CSS#initialize})
def to_sass(options = {})
  Sass::Tree::Visitors::Convert.visit(self, options, :sass)
end

def to_scss(options = {})

Returns:
  • (String) - The Sass code corresponding to the node

Parameters:
  • options ({Symbol => Object}) -- An options hash (see {Sass::CSS#initialize})
def to_scss(options = {})
  Sass::Tree::Visitors::Convert.visit(self, options, :scss)
end