Sha256: 37ee2573ac18bb68d1fc0123420ffbd457c2108904374c4bd03ca1c1182f3d0b

Contents?: true

Size: 366 Bytes

Versions: 159

Compression:

Stored size: 366 Bytes

Contents

module Generator
  module Underscore
    refine String do
      def underscore
        downcase.gsub(/[- ]/, '_').gsub(/[^\w?]/, '')
      end

      def camel_case
        underscore.split('_').map(&:capitalize).join
      end
    end

    refine Integer do
      def underscore
        self.to_s.reverse.gsub(/...(?=.)/, '\&_').reverse
      end
    end
  end
end

Version data entries

159 entries across 159 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.97 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.96 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.95 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.94 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.93 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.92 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.91 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.90 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.89 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.88 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.87 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.86 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.85 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.84 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.83 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.82 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.81 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.80 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.79 tracks/ruby/lib/generator/underscore.rb