class Sass::Tree::ForNode

@see Sass::Tree
A dynamic node representing a Sass ‘@for` loop.

def _perform(environment)

Other tags:
    See: Sass::Tree -

Returns:
  • (Array) - The resulting static nodes

Parameters:
  • environment (Sass::Environment) -- The lexical environment containing
def _perform(environment)
  from = @from.perform(environment)
  to = @to.perform(environment)
  from.assert_int!
  to.assert_int!
  to = to.coerce(from.numerator_units, from.denominator_units)
  range = Range.new(from.to_i, to.to_i, @exclusive)
  children = []
  environment = Sass::Environment.new(environment)
  range.each do |i|
    environment.set_local_var(@var, Sass::Script::Number.new(i, from.numerator_units, from.denominator_units))
    children += perform_children(environment)
  end
  children
end

def initialize(var, from, to, exclusive)

Parameters:
  • exclusive (Boolean) -- Whether to include `to` in the loop
  • to (Script::Node) -- The parse tree for the final expression
  • from (Script::Node) -- The parse tree for the initial expression
  • var (String) -- The name of the loop variable
def initialize(var, from, to, exclusive)
  @var = var
  @from = from
  @to = to
  @exclusive = exclusive
  super()
end

def to_src(tabs, opts, fmt)

Other tags:
    See: Node#to_src -
def to_src(tabs, opts, fmt)
  to = @exclusive ? "to" : "through"
  "#{'  ' * tabs}@for $#{dasherize(@var, opts)} from #{@from.to_sass(opts)} #{to} #{@to.to_sass(opts)}" +
    children_to_src(tabs, opts, fmt)
end