def add_class(css_class, options = {})
      return {} unless css_class

      attributes = {:class => css_class}

      if options.has_key?(:unless)
        return options[:unless] ? {} : attributes
      end

      if options.has_key?(:if)
        return options[:if] ? attributes : {}
      end

      attributes
    end
def add_class(css_class, options = {})
      return {} unless css_class

      attributes = {:class => css_class}

      if options.has_key?(:unless)
        return options[:unless] ? {} : attributes
      end

      if options.has_key?(:if)
        return options[:if] ? attributes : {}
      end

      attributes
    end
provides a slick way to add classes inside haml attribute collections

 examples:
   %div{add_class("current")}
   #=> adds the "current" class to the div

   %div{add_class("current", :if => current?)}
   #=> adds the "current" class to the div if current? method

   %div{add_class("highlight", :unless => logged_in?)}
   #=> adds the "highlight" class to the div unless logged_in? method returns true