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.38 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.37 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.36 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.35 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.34 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.33 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.32 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.31 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.30 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.29 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.28 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.27 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.26 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.25 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.24 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.23 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.22 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.21 tracks/ruby/lib/generator/underscore.rb
trackler-2.2.1.20 tracks/ruby/lib/generator/underscore.rb