Class: Sass::Tree::WhileNode

Inherits:
Node
  • Object
show all
Defined in:
lib/sass/tree/while_node.rb

Overview

A dynamic node representing a Sass @while loop.

See Also:

Instance Attribute Summary

Attributes inherited from Node

#children, #filename, #has_children, #line, #options

Instance Method Summary collapse

Methods inherited from Node

#<<, #==, #_cssize, #_to_s, #balance, #check_child!, #children_to_src, #cssize, #cssize!, #dasherize, #do_extend, #each, #invalid_child?, #invisible?, #perform, #perform!, #perform_children, #render, #run_interp, #semi, #style, #to_s, #to_sass, #to_scss

Constructor Details

#initialize(expr) ⇒ WhileNode

Returns a new instance of WhileNode.

Parameters:

  • expr (Script::Node)

    The parse tree for the continue expression



9
10
11
12
# File 'lib/sass/tree/while_node.rb', line 9

def initialize(expr)
  @expr = expr
  super()
end

Instance Method Details

#_perform(environment) ⇒ Array<Tree::Node> (protected)

Runs the child nodes until the continue expression becomes false.

Parameters:

  • environment (Sass::Environment)

    The lexical environment containing variable and mixin values

Returns:

  • (Array<Tree::Node>)

    The resulting static nodes

See Also:



27
28
29
30
31
32
33
34
# File 'lib/sass/tree/while_node.rb', line 27

def _perform(environment)
  children = []
  new_environment = Sass::Environment.new(environment)
  while @expr.perform(environment).to_bool
    children += perform_children(new_environment)
  end
  children
end

#to_src(tabs, opts, fmt) (protected)

See Also:



17
18
19
# File 'lib/sass/tree/while_node.rb', line 17

def to_src(tabs, opts, fmt)
  "#{'  ' * tabs}@while #{@expr.to_sass(opts)}" + children_to_src(tabs, opts, fmt)
end