module Haml::Helpers

def merge_name_and_attributes(name, attributes_hash = {})

and merges it with the Ruby attributes hash.
Parses the tag name used for \{#haml\_tag}
def merge_name_and_attributes(name, attributes_hash = {})
  # skip merging if no ids or classes found in name
  return name, attributes_hash unless name =~ /^(.+?)?([\.#].*)$/
  return $1 || "div", Buffer.merge_attrs(
    Haml::Parser.parse_class_and_id($2), attributes_hash)
end