Sha256: 66bd74bad6ea34f8247eb84f2f9227f66af0674cc056364faf8aa5015508c5bc

Contents?: true

Size: 309 Bytes

Versions: 11

Compression:

Stored size: 309 Bytes

Contents

module ActiveSupportMethods
  def camelize
    sub(/^([a-z])/) {$1.upcase}.gsub(/_([a-z])/) do
      $1.upcase
    end
  end
  
  def underscore
    gsub(/([A-Z])/) do
      '_' + $1.downcase
    end.sub(/^_/, '')
  end
end

String.send :include, ActiveSupportMethods #unless String.new.respond_to?(:camelize)

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
langalex-couch_potato-0.2.0 lib/core_ext/string.rb
langalex-couch_potato-0.2.1 lib/core_ext/string.rb
langalex-couch_potato-0.2.2 lib/core_ext/string.rb
langalex-couch_potato-0.2.3 lib/core_ext/string.rb
langalex-couch_potato-0.2.4 lib/core_ext/string.rb
langalex-couch_potato-0.2.5 lib/core_ext/string.rb
langalex-couch_potato-0.2.6 lib/core_ext/string.rb
langalex-couch_potato-0.2.7 lib/core_ext/string.rb
speedmax-couch_potato-0.2.0 lib/core_ext/string.rb
speedmax-couch_potato-0.2.2 lib/core_ext/string.rb
thefool808-couch_potato-0.2.7 lib/core_ext/string.rb