Sha256: 835a5b972ebd2914cb39e14d5ea81c78d26c88ad792cba8717cec699b473348c

Contents?: true

Size: 496 Bytes

Versions: 2

Compression:

Stored size: 496 Bytes

Contents

class String


  def self.camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
    if first_letter_in_uppercase
      lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
    else
      lower_case_and_underscored_word.to_s[0].chr.downcase + camelize(lower_case_and_underscored_word)[1..-1]
    end
  end

  def camelize! (first_letter_in_uppercase = true)
    String.camelize(self, first_letter_in_uppercase)
  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ratlas-0.1.2 lib/patches/string.rb
ratlas-0.1.1 lib/patches/string.rb