tracks/ruby/lib/generator/underscore.rb in trackler-2.1.0.36 vs tracks/ruby/lib/generator/underscore.rb in trackler-2.1.0.37
- old
+ new
@@ -2,9 +2,13 @@
module Underscore
refine String do
def underscore
downcase.gsub(/[- ]/, '_').gsub(/[^\w?]/, '')
end
+
+ def camel_case
+ underscore.split('_').map(&:capitalize).join
+ end
end
refine Fixnum do
def underscore
self.to_s.reverse.gsub(/...(?=.)/, '\&_').reverse