Sha256: 223eb626349356b8d699dada9f99b36f05733708b22542f81bd7996761c3d1cb

Contents?: true

Size: 280 Bytes

Versions: 19

Compression:

Stored size: 280 Bytes

Contents

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

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
trackler-2.1.0.36 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.34 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.33 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.32 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.31 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.30 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.29 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.28 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.27 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.26 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.25 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.24 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.23 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.22 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.21 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.20 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.19 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.18 tracks/ruby/lib/generator/underscore.rb
trackler-2.1.0.17 tracks/ruby/lib/generator/underscore.rb