Sha256: a4892a18eea20734e54b8e7c1f584851eeb72df355435d0ec33ddfe647bbfb0e

Contents?: true

Size: 498 Bytes

Versions: 12

Compression:

Stored size: 498 Bytes

Contents

require 'forwardable'

# Avoid the monkey patching of String for camelize
class CamelString
  extend Forwardable
  def_delegators(:@string, *String.public_instance_methods(false))
  def initialize(str = 'no_name')
    @string = (str.length > 60) ? 'long_name' : str
  end

  def camelize(first_letter_in_uppercase = true)
    if first_letter_in_uppercase
      @string.gsub(/\/(.?)/) { '::' + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
    else
      @string[0] + camelize[1..-1]
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
ruby-processing-2.6.12 lib/ruby-processing/helpers/camel_string.rb
ruby-processing-2.6.11 lib/ruby-processing/helpers/camel_string.rb
jruby_art-0.2.6.pre lib/jruby_art/helpers/camel_string.rb
ruby-processing-2.6.10 lib/ruby-processing/helpers/camel_string.rb
ruby-processing-2.6.9 lib/ruby-processing/helpers/camel_string.rb
ruby-processing-2.6.8 lib/ruby-processing/helpers/camel_string.rb
jruby_art-0.2.4.pre lib/jruby_art/helpers/camel_string.rb
jruby_art-0.2.3.pre lib/jruby_art/helpers/camel_string.rb
jruby_art-0.2.2.pre lib/jruby_art/helpers/camel_string.rb
jruby_art-0.2.1.pre lib/jruby_art/helpers/camel_string.rb
ruby-processing-2.6.7 lib/ruby-processing/helpers/camel_string.rb
jruby_art-0.2.0.pre lib/jruby_art/helpers/camel_string.rb