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/variable_node.rb

25 lines
516 B
Ruby
Raw Normal View History

module Sass
module Tree
class VariableNode < Node
def initialize(name, expr, guarded, options)
@name = name
@expr = expr
@guarded = guarded
super(options)
end
protected
def _perform(environment)
2008-10-15 20:00:28 -07:00
if @guarded && environment.var(@name).nil?
environment.set_var(@name, @expr.perform(environment))
elsif !@guarded
environment.set_var(@name, @expr.perform(environment))
end
[]
end
end
end
end