Class: String

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

Instance Method Summary collapse

Instance Method Details

#first_capsObject



2
3
4
# File 'lib/required/string.rb', line 2

def first_caps
  self.split(/ /).map{|x| x.capitalize}.join(' ')
end

#from_peObject



8
9
10
# File 'lib/required/string.rb', line 8

def from_pe
  "hi, I'm from the pixelearth gem"
end

#my_underscoreObject

fills in the gap in rails inflectors, since their #underscore method only works for CamelCase



5
6
7
# File 'lib/required/string.rb', line 5

def my_underscore #fills in the gap in rails inflectors, since their #underscore method only works for CamelCase
  self.downcase.gsub(/\s+/,"_")
end