Class: Formation::Util

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

Class Method Summary collapse

Class Method Details

.titleize(string) ⇒ Object



3
4
5
# File 'lib/formation/util.rb', line 3

def self.titleize(string)
  string.to_s.gsub(/_/, ' ').gsub(/\b\w/) { $&.upcase }
end

.underscore(string) ⇒ Object



7
8
9
# File 'lib/formation/util.rb', line 7

def self.underscore(string)
  string.to_s.downcase.gsub(/\s/, '_')
end