class Sass::Tree::Node

def <<(child)

Other tags:
    See: #invalid_child? -

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

Parameters:
  • child (Tree::Node) -- The child node
def <<(child)
  if msg = invalid_child?(child)
    raise Sass::SyntaxError.new(msg, child.line)
  end
  @children << child
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 _perform(environment)

Other tags:
    See: Sass::Tree -
    See: #perform -

Returns:
  • (Tree::Node, Array) - The resulting static nodes

Parameters:
  • environment (Sass::Environment) -- The lexical environment containing
def _perform(environment)
  node = dup
  node.perform!(environment)
  node
end

def balance(*args)

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

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

def filename

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

def initialize

def initialize
  @children = []
end

def interpolate(text, environment)

Returns:
  • (String) - The interpolated text

Parameters:
  • environment (Sass::Environment) -- The lexical environment containing
  • text (String) -- The text to interpolate
def interpolate(text, environment)
  res = ''
  rest = Haml::Shared.handle_interpolation text do |scan|
    escapes = scan[2].size
    res << scan.matched[0...-2 - escapes]
    if escapes % 2 == 1
      res << "\\" * (escapes - 1) << '#{'
    else
      res << "\\" * [0, escapes - 1].max
      res << Script::Parser.new(scan, line, scan.pos - scan.matched_size, filename).
        parse_interpolated.perform(environment).to_s
    end
  end
  res + rest
end

def invalid_child?(child)

Returns:
  • (Boolean, String) - Whether or not the child node is valid,

Parameters:
  • child (Tree::Node) -- A potential child node
def invalid_child?(child)
  false
end

def invisible?; false; end

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

def last

Returns:
  • (Tree::Node) - The last child node
def last
  children.last
end

def options=(options)

Other tags:
    See: #options -

Parameters:
  • options (Hash) -- The options
def options=(options)
  children.each {|c| c.options = options}
  @options = options
end

def perform(environment)

Other tags:
    See: Sass::Tree -

Raises:
  • (Sass::SyntaxError) - if some element of the tree is invalid

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

Parameters:
  • environment (Sass::Environment) -- The lexical environment containing
def perform(environment)
  environment.options = @options if self.class == Tree::Node
  _perform(environment)
rescue Sass::SyntaxError => e; e.add_metadata(filename, line)
end

def perform!(environment)

Other tags:
    See: #perform -

Parameters:
  • environment (Sass::Environment) -- The lexical environment containing
def perform!(environment)
  self.children = perform_children(Environment.new(environment))
end

def perform_children(environment)

Returns:
  • (Array) - The resulting static nodes

Parameters:
  • environment (Sass::Environment) -- The lexical environment containing
def perform_children(environment)
  children.map {|c| c.perform(environment)}.flatten
end

def render

Other tags:
    See: #to_s -
    See: #perform -
def render
  perform(Environment.new).to_s
end

def style

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

def to_s

Other tags:
    See: Sass::Tree -

Raises:
  • (Sass::SyntaxError) - if some element of the tree is invalid

Returns:
  • (String, nil) - The resulting CSS
def to_s
  result = String.new
  children.each do |child|
    if child.is_a? PropNode
      raise Sass::SyntaxError.new('Properties aren\'t allowed at the root of a document.', child.line)
    else
      next if child.invisible?
      child_str = child.to_s(1)
      result << child_str + (style == :compressed ? '' : "\n")
    end
  end
  result.rstrip!
  return "" if result.empty?
  return result + "\n"
rescue Sass::SyntaxError => e; e.add_metadata(filename, line)
end

def to_sass(tabs = 0, opts = {})

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

Parameters:
  • opts (Hash) -- An options hash (see {Sass::CSS#initialize})
  • tabs (Fixnum) -- The amount of tabulation to use for the Sass code
def to_sass(tabs = 0, opts = {})
  result = ''
  children.each do |child|
    result << "#{'  ' * tabs}#{child.to_sass(0, opts)}\n"
  end
  result
end