Sha256: cf0cb289547d24644e02b61fef2f1f5b3833492fcfb9f06e054ef6e8a6a64df4

Contents?: true

Size: 961 Bytes

Versions: 25

Compression:

Stored size: 961 Bytes

Contents

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

    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<Tree::Node>] 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

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
haml-edge-2.3.209 lib/sass/tree/while_node.rb
haml-3.0.0.beta.3 lib/sass/tree/while_node.rb
haml-edge-2.3.208 lib/sass/tree/while_node.rb
haml-edge-2.3.207 lib/sass/tree/while_node.rb
haml-edge-2.3.206 lib/sass/tree/while_node.rb
haml-edge-2.3.205 lib/sass/tree/while_node.rb
haml-edge-2.3.204 lib/sass/tree/while_node.rb
haml-3.0.0.beta.2 lib/sass/tree/while_node.rb
haml-edge-2.3.203 lib/sass/tree/while_node.rb
haml-edge-2.3.202 lib/sass/tree/while_node.rb
haml-edge-2.3.201 lib/sass/tree/while_node.rb
haml-edge-2.3.200 lib/sass/tree/while_node.rb
haml-edge-2.3.199 lib/sass/tree/while_node.rb
haml-edge-2.3.198 lib/sass/tree/while_node.rb
haml-edge-2.3.197 lib/sass/tree/while_node.rb
haml-edge-2.3.196 lib/sass/tree/while_node.rb
haml-edge-2.3.195 lib/sass/tree/while_node.rb
haml-edge-2.3.194 lib/sass/tree/while_node.rb
haml-edge-2.3.193 lib/sass/tree/while_node.rb
haml-edge-2.3.192 lib/sass/tree/while_node.rb