Class: String
- Inherits:
-
Object
show all
- Defined in:
- lib/gamefic/core_ext/string.rb
Instance Method Summary
collapse
Instance Method Details
#cap_first ⇒ String
8
9
10
|
# File 'lib/gamefic/core_ext/string.rb', line 8
def cap_first
self.capitalize_first
end
|
#capitalize_first ⇒ Object
Capitalize the first letter without changing the rest of the string. (String#capitalize makes the rest of the string lower-case.)
4
5
6
|
# File 'lib/gamefic/core_ext/string.rb', line 4
def capitalize_first
"#{self[0,1].upcase}#{self[1,self.length]}"
end
|
#split_words ⇒ Array
12
13
14
|
# File 'lib/gamefic/core_ext/string.rb', line 12
def split_words
self.gsub(/ +/, ' ').strip.split
end
|