Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/required/string.rb
Instance Method Summary collapse
- #first_caps ⇒ Object
- #from_pe ⇒ Object
-
#my_underscore ⇒ Object
fills in the gap in rails inflectors, since their #underscore method only works for CamelCase.
Instance Method Details
#first_caps ⇒ Object
2 3 4 |
# File 'lib/required/string.rb', line 2 def first_caps self.split(/ /).map{|x| x.capitalize}.join(' ') end |
#from_pe ⇒ Object
8 9 10 |
# File 'lib/required/string.rb', line 8 def from_pe "hi, I'm from the pixelearth gem" end |
#my_underscore ⇒ Object
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 |