lib/hentry_consumer.rb in hentry_consumer-0.5.1 vs lib/hentry_consumer.rb in hentry_consumer-0.5.2

- old
+ new

@@ -14,5 +14,15 @@ extend ClassMethods def self.included(other) other.extend(ClassMethods) end end + +class String + def underscore + self.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). + gsub(/([a-z\d])([A-Z])/,'\1_\2'). + tr("-", "_"). + downcase + end +end