Class: String
Instance Method Summary collapse
-
#computerize ⇒ Object
Opposite of humanize.
-
#pluralize_to_sym ⇒ Object
pluralizes a string and turns it into a symbol Example: “apple”.pluralize_to_sym # => :apples.
Instance Method Details
#computerize ⇒ Object
Opposite of humanize. Converts to lower case and converts spaces to underscores. Example:
"Add Book".computerize # => "add_book"
14 15 16 |
# File 'lib/extensions/string.rb', line 14 def computerize self.underscore.downcase.gsub ' ', '_' end |
#pluralize_to_sym ⇒ Object
pluralizes a string and turns it into a symbol Example:
"apple".pluralize_to_sym # => :apples
8 9 10 |
# File 'lib/extensions/string.rb', line 8 def pluralize_to_sym self.pluralize.to_sym end |