| Class | Sass::Tree::WhileNode |
| In: |
lib/sass/tree/while_node.rb
|
| Parent: | Node |
A dynamic node representing a Sass `@while` loop.
@see Sass::Tree
@param expr [Script::Node] The parse tree for the continue expression
# File lib/sass/tree/while_node.rb, line 9
9: def initialize(expr)
10: @expr = expr
11: super()
12: end
Runs the child nodes until the continue expression becomes false.
@param environment [Sass::Environment] The lexical environment containing
variable and mixin values
@return [Array<Tree::Node>] The resulting static nodes @see Sass::Tree
# File lib/sass/tree/while_node.rb, line 27
27: def _perform(environment)
28: children = []
29: new_environment = Sass::Environment.new(environment)
30: while @expr.perform(environment).to_bool
31: children += perform_children(new_environment)
32: end
33: children
34: end
@see Node#to_src
# File lib/sass/tree/while_node.rb, line 17
17: def to_src(tabs, opts, fmt)
18: "#{' ' * tabs}@while #{@expr.to_sass(opts)}" + children_to_src(tabs, opts, fmt)
19: end