haml-3.0.25.lib.sass.tree.while_node.rb Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalate-jruby_2.10 Show documentation
Show all versions of scalate-jruby_2.10 Show documentation
Scalate integration with JRuby to access Ruby based filters such as sass
The newest version!
require 'sass/tree/node'
module Sass::Tree
# A dynamic node representing a Sass `@while` loop.
#
# @see Sass::Tree
class WhileNode < Node
# @param expr [Script::Node] The parse tree for the continue expression
def initialize(expr)
@expr = expr
super()
end
protected
# @see Node#to_src
def to_src(tabs, opts, fmt)
"#{' ' * tabs}@while #{@expr.to_sass(opts)}" + children_to_src(tabs, opts, fmt)
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] The resulting static nodes
# @see Sass::Tree
def _perform(environment)
children = []
new_environment = Sass::Environment.new(environment)
while @expr.perform(environment).to_bool
children += perform_children(new_environment)
end
children
end
end
end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy