class Haml::Parser

def self.parse_class_and_id(list)

that can then be merged with another attributes hash.
and `#` syntax, and returns a hash with them as attributes,
Iterates through the classes and ids supplied through `.`

This is a class method so it can be accessed from {Haml::Helpers}.
def self.parse_class_and_id(list)
  attributes = {}
  return attributes if list.empty?
  list.scan(/([#.])([-:_a-zA-Z0-9\@]+)/) do |type, property|
    case type
    when '.'
      if attributes[CLASS_KEY]
        attributes[CLASS_KEY] += " "
      else
        attributes[CLASS_KEY] = ""
      end
      attributes[CLASS_KEY] += property
    when '#'; attributes[ID_KEY] = property
    end
  end
  attributes
end