1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/lib/sass/tree/for_node.rb
2009-04-21 20:36:46 -07:00

29 lines
654 B
Ruby

require 'sass/tree/node'
module Sass::Tree
class ForNode < Node
def initialize(var, from, to, exclusive)
@var = var
@from = from
@to = to
@exclusive = exclusive
super()
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