Sha256: 7ad52c87e460eb68bf2056a8388971c0555b7c94ca96600ed78ab354f33b1da8

Contents?: true

Size: 670 Bytes

Versions: 6

Compression:

Stored size: 670 Bytes

Contents

require 'sass/tree/node'

module Sass::Tree
  class ForNode < Node
    def initialize(var, from, to, exclusive, options)
      @var = var
      @from = from
      @to = to
      @exclusive = exclusive
      super(options)
    end

    protected

    def _perform(environment)
      from = @from.perform(environment).to_i
      to = @to.perform(environment).to_i
      range = Range.new(from, to, @exclusive)

      children = []
      environment = Sass::Environment.new(environment)
      range.each do |i|
        environment.set_local_var(@var, Sass::Script::Number.new(i))
        children += perform_children(environment)
      end
      children
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
haml-edge-2.1.1 lib/sass/tree/for_node.rb
haml-edge-2.1.2 lib/sass/tree/for_node.rb
haml-edge-2.1.3 lib/sass/tree/for_node.rb
haml-edge-2.1.4 lib/sass/tree/for_node.rb
haml-edge-2.1.5 lib/sass/tree/for_node.rb
haml-edge-2.1.6 lib/sass/tree/for_node.rb