Sha256: a6e6b7e4eabe629944cb5d463d74fb149fa55983faf31c132edddfe551787997

Contents?: true

Size: 317 Bytes

Versions: 7

Compression:

Stored size: 317 Bytes

Contents

unless String.instance_methods.include? 'underscore'
  class String
    # Yes, oh Rails, I stealz you so bad
    def underscore
       self.gsub(/::/, '/').
            gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
            gsub(/([a-z\d])([A-Z])/,'\1_\2').
            tr("-", "_").
            downcase
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
asciidoctor-0.0.7 lib/asciidoctor/string.rb
asciidoctor-0.0.6 lib/asciidoctor/string.rb
asciidoctor-0.0.5 lib/asciidoctor/string.rb
asciidoctor-0.0.4 lib/asciidoctor/string.rb
asciidoctor-0.0.3 lib/asciidoctor/string.rb
asciidoctor-0.0.2 lib/asciidoctor/string.rb
asciidoctor-0.0.1 lib/asciidoctor/string.rb