Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/aurora_file_processor.rb

Overview

String class: adds two methods

Author: Renee Hendrickson Credit: thanksgiving_dinner.rb answer key

Instance Method Summary collapse

Instance Method Details

#humanizeObject

A method to replace underscores in variable names with spaces for human reading



31
32
33
# File 'lib/aurora_file_processor.rb', line 31

def humanize
	self.gsub('_',' ').titlecase
end

#titlecaseObject

A method that upcases the first letter of each word



26
27
28
# File 'lib/aurora_file_processor.rb', line 26

def titlecase
	self.gsub(/\b\w/){|f| f.upcase}
end