Sha256: 6b546aee2519ca147b8a35c57413d7ced1a436a6ba68a32a2a4abb9baef2cbc8

Contents?: true

Size: 389 Bytes

Versions: 1

Compression:

Stored size: 389 Bytes

Contents

class String
  # @it should turn hello_world into HelloWorld
  #   "hello_world".camelcase.should == "HelloWorld"
  def underscore
    gsub(/([a-z])([A-Z])/, '\1_\2').downcase 
  end
  
  # @it should turn HelloWorld into hello_world
  #   "HelloWorld".underscore.should == "hello_world"
  def camelcase
    gsub(/([a-z])_([a-z])/i) { $1 + $2.upcase }.sub(/^(.)/) { $1.upcase } 
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yard-0.2.2 lib/yard/core_ext/string.rb