class Haml::Buffer

def underscore(camel_cased_word)

but copied here so it'll run properly without Rails.
Based on the method of the same name in Rails' Inflector,
Changes a word from camel case to underscores.
def underscore(camel_cased_word)
  camel_cased_word.to_s.gsub(/::/, '_').
    gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
    gsub(/([a-z\d])([A-Z])/,'\1_\2').
    tr("-", "_").
    downcase
end