Sha256: a0462b9cf83a5da38e3bce102a114fbeb737d803be8104f1cc50f2bb1d20a251

Contents?: true

Size: 452 Bytes

Versions: 7

Compression:

Stored size: 452 Bytes

Contents

require 'rubygems'
require 'activesupport'

class String
  # pluralizes a string and turns it into a symbol
  # Example:
  #  "apple".pluralize_to_sym    # => :apples
  def pluralize_to_sym
    self.pluralize.to_sym
  end
  # Opposite of humanize. Converts to lower case and converts spaces to underscores. 
  # Example:
  #   "Add Book".computerize # => "add_book"
  def computerize
    self.underscore.downcase.gsub ' ', '_'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bret-watircraft-0.4.0 lib/extensions/string.rb
bret-watircraft-0.4.1 lib/extensions/string.rb
bret-watircraft-0.4.2 lib/extensions/string.rb
bret-watircraft-0.4.3 lib/extensions/string.rb
bret-watircraft-0.4.4 lib/extensions/string.rb
bret-watircraft-0.4.5 lib/extensions/string.rb
bret-watircraft-0.5.0 lib/extensions/string.rb