Sha256: c82d231bd02dc07c477a79ca4a116bdf33a1feb9c85e31829ef5c0b19d2ac9fd

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

require 'nano/string/camelcase'

class Symbol

  # Converts a symbol to camelcase. By default capitalization
  # occurs on whitespace and underscores. By setting the first
  # parameter to <tt>true</tt> the first character can also be
  # captizlized. The second parameter can be assigned a valid
  # Regualr Expression characeter set to determine which
  # characters to match for capitalizing subsequent parts of
  # the symbol.
  #
  #   :this_is_a_test.camelcase              #=> :ThisIsATest
  #   :this_is_a_test.camelcase(false)       #=> :thisIsATest
  #
  def camelcase( *args )
    self.to_s.camelcase( *args ).to_sym
  end

end


#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCSymbol < Test::Unit::TestCase

    def test_camelcase
      assert_equal( :thisIsTest, :this_is_test.camelcase )
    end

  end

=end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.9.0 lib/nano/symbol/camelcase.rb