acts_like_string?

acts_like_string?() Instance Public methods Enable more predictable duck-typing on String-like classes. See Object#acts_like?.

at

at(position) Instance Public methods If you pass a single Fixnum, returns a substring of one character at that position. The first character of the string is at position 0, the next at position 1, and so on. If a range is supplied, a substring containing characters at offsets given by the range is returned. In both cases, if an offset is negative, it is counted from the end of the string. Returns nil if the initial offset falls outside the string. Returns an empty string if the beg

blank?

blank?() Instance Public methods A string is blank if it's empty or contains whitespaces only: ''.blank? # => true ' '.blank? # => true "\t\n\r".blank? # => true ' blah '.blank? # => false Unicode whitespace is supported: "\u00a0".blank? # => true @return [true, false]

camelcase

camelcase(first_letter = :upper) Instance Public methods Alias for: camelize

camelize

camelize(first_letter = :upper) Instance Public methods By default, camelize converts strings to UpperCamelCase. If the argument to camelize is set to :lower then camelize produces lowerCamelCase. camelize will also convert '/' to '::' which is useful for converting paths to namespaces. 'active_record'.camelize # => "ActiveRecord" 'active_record'.camelize(:lower) # => "activeRecord" 'active_record/errors'.camelize # => "ActiveRecord::Errors" '

classify

classify() Instance Public methods Create a class name from a plural table name like Rails does for table names to models. Note that this returns a string and not a class. (To convert to an actual class follow classify with constantize.) 'egg_and_hams'.classify # => "EggAndHam" 'posts'.classify # => "Post"

constantize

constantize() Instance Public methods constantize tries to find a declared constant with the name specified in the string. It raises a NameError when the name is not in CamelCase or is not initialized. See ActiveSupport::Inflector#constantize 'Module'.constantize # => Module 'Class'.constantize # => Class 'blargle'.constantize # => NameError: wrong constant name blargle

dasherize

dasherize() Instance Public methods Replaces underscores with dashes in the string. 'puni_puni'.dasherize # => "puni-puni"

deconstantize

deconstantize() Instance Public methods Removes the rightmost segment from the constant expression in the string. 'Net::HTTP'.deconstantize # => "Net" '::Net::HTTP'.deconstantize # => "::Net" 'String'.deconstantize # => "" '::String'.deconstantize # => "" ''.deconstantize # => "" See also demodulize.

demodulize

demodulize() Instance Public methods Removes the module part from the constant expression in the string. 'ActiveRecord::CoreExtensions::String::Inflections'.demodulize # => "Inflections" 'Inflections'.demodulize # => "Inflections" See also deconstantize.