class Haml::AttributeCompiler

def compile_id_or_class_attribute(id_or_class, values)

Returns:
  • (Array) - Temple expression

Parameters:
  • values (Array) --
  • id_or_class (String) -- "id" or "class"
def compile_id_or_class_attribute(id_or_class, values)
  var = unique_name
  [:multi,
   [:code, "#{var} = (#{merged_value(id_or_class, values)})"],
   [:case, var,
    ['Hash, Array', runtime_build([AttributeValue.new(:dynamic, id_or_class, var)])],
    ['false, nil', [:multi]],
    [:else, [:multi,
             [:static, " #{id_or_class}=#{@attr_wrapper}"],
             [:escape, @escape_attrs, [:dynamic, var]],
             [:static, @attr_wrapper]],
    ]
   ],
  ]
end