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.119 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.118 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.117 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.116 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.115 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.114 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.113 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.111 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.110 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.109 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.108 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.107 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.106 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.105 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.104 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.103 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.102 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.101 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.100 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.99 tracks/ruby/lib/generator/underscore.rb