Class: String

Inherits:
Object show all
Defined in:
lib/extensions/string.rb

Instance Method Summary collapse

Instance Method Details

#computerizeObject

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_symObject

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