Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/gamefic/core_ext/string.rb
Instance Method Summary collapse
- #cap_first ⇒ String
-
#capitalize_first ⇒ Object
Capitalize the first letter without changing the rest of the string.
- #split_words ⇒ Array
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 |