class Haml::AttributeCompiler
def compile_boolean!(temple, key, values)
def compile_boolean!(temple, key, values) exp = literal_for(values.last) if Temple::StaticAnalyzer.static?(exp) value = eval(exp) case value when true then temple << [:html, :attr, key, @format == :xhtml ? [:static, key] : [:multi]] when false, nil else temple << [:html, :attr, key, [:fescape, @escape_attrs, [:static, value.to_s]]] end else var = @identity.generate temple << [ :case, "(#{var} = (#{exp}))", ['true', [:html, :attr, key, @format == :xhtml ? [:static, key] : [:multi]]], ['false, nil', [:multi]], [:else, [:multi, [:static, " #{key}=#{@quote}"], [:fescape, @escape_attrs, [:dynamic, var]], [:static, @quote]]], ] end end