| Start |
|---|
Core Extensions: String Access String#at (opens new window)Returns a substring of a string object. Same interface as String#from (opens new window)Returns a substring from the given position to the end of the string. String#to (opens new window)Returns a substring from the beginning of the string to the given position.
String#first (opens new window)Returns the first character, or a given number of characters up to the length of the string. String#last (opens new window)Returns the last character, or a given number of characters from the end of the string counting backwards. |
Core Extensions: String to Date/Time Conversion String#to_time (opens new window)Converts a string to a Time value. The String#to_date (opens new window)Converts a string to a Date value. String#to_datetime (opens new window)Converts a string to a DateTime value. |
Core Extensions: String Exclusion String#exclude? (opens new window)The inverse of |
Core Extensions: String Filters String#squish (opens new window)Returns a version of the given string without leading or trailing whitespace, and combines all consecutive whitespace in the interior to single spaces. Destructive version Handles both ASCII and Unicode whitespace. String#truncate (opens new window)String#strip_heredoc (opens new window) |
Core Extensions: String Inflection String#pluralize (opens new window)Returns of plural form of the string. Optionally takes a String#singularize (opens new window)Returns the singular form of the string. Accepts an optional String#constantize (opens new window)Tries to find a declared constant with the name specified in the string. It raises a String#safe_constantize (opens new window)Performs a String#camelize (opens new window)Converts strings to UpperCamelCase by default, if alias: Note: will also convert String#titleize (opens new window)Capitalizes all the words and replaces some characters in the string to create a nicer looking title. alias: String#underscore (opens new window)Makes an underscored, lowercase form from the expression in the string. The reverse of Note: String#dasherize (opens new window)Replaces underscores with dashes in the string. String#demodulize (opens new window)Removes the module part from the constant expression in the string. String#deconstantize (opens new window)Removes the rightmost segment from the constant expression in the string. String#parameterize (opens new window)Replaces special characters in a string so that it may be used as part of a 'pretty' URL. Preserve the case of the characters in a string with the A very common use-case for String#tableize (opens new window)Creates the name of a table like Rails does for models to table names. Pluralizes the last word in the string. String#classify (opens new window)Returns a class name string from a plural table name like Rails does for table names to models. String#humanize (opens new window)Capitalizes the first word, turns underscores into spaces, and strips a trailing String#upcase_first (opens new window)Converts just the first character to uppercase. String#foreign_key (opens new window)Creates a foreign key name from a class name. Pass RemarksActiveSupport is a utility gem of general-purpose tools used by the rest of the Rails framework. One of the primary ways it provides these tools is by monkeypatching Ruby's native types. These are referred to as Core Extensions. |
Read Article
https://develop.horje.com/learn/1434/reference