class Sass::Tree::IfNode

@see Sass::Tree
each {IfNode} has a link ({#else}) to the next {IfNode}.
This is done as a linked list:
{IfNode}s are a little odd, in that they also represent ‘@else` and `@else if`s.
A dynamic node representing a Sass `@if` statement.

def _perform(environment)

Other tags:
    See: Sass::Tree -

Returns:
  • (Array) - The resulting static nodes

Parameters:
  • environment (Sass::Environment) -- The lexical environment containing
def _perform(environment)
  environment = Sass::Environment.new(environment)
  return perform_children(environment) if @expr.nil? || @expr.perform(environment).to_bool
  return @else.perform(environment) if @else
  []
end

def add_else(node)

Parameters:
  • node (IfNode) -- The `@else` node to append
def add_else(node)
  @last_else.else = node
  @last_else = node
end

def initialize(expr)

Parameters:
  • expr (Script::Expr) -- The conditional expression.
def initialize(expr)
  @expr = expr
  @last_else = self
  super()
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)
  super unless child.is_a?(ExtendNode)
end

def options=(options)

Other tags:
    See: Node#options= -
def options=(options)
  super
  self.else.options = options if self.else
end

def to_src(tabs, opts, fmt, is_else = false)

Other tags:
    See: Node#to_src -
def to_src(tabs, opts, fmt, is_else = false)
  name =
    if !is_else; "if"
    elsif @expr; "else if"
    else; "else"
    end
  str = "#{'  ' * tabs}@#{name}"
  str << " #{@expr.to_sass(opts)}" if @expr
  str << children_to_src(tabs, opts, fmt)
  str << @else.send(:to_src, tabs, opts, fmt, true) if @else
  str
end