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 = {}
  list.scan(/([#.])([-:_a-zA-Z0-9]+)/) do |type, property|
    case type
    when '.'
      if attributes['class']
        attributes['class'] += " "
      else
        attributes['class'] = ""
      end
      attributes['class'] += property
    when '#'; attributes['id'] = property
    end
  end
  attributes
end