Class: String
- Inherits:
-
Object
- Object
- String
- Includes:
- Gamefic::Matchable
- Defined in:
- lib/gamefic/core_ext/string.rb
Constant Summary
Constants included from Gamefic::Matchable
Gamefic::Matchable::SPLIT_REGEXP
Instance Method Summary collapse
- #cap_first ⇒ String
-
#capitalize_first ⇒ Object
Capitalize the first letter without changing the rest of the string.
- #split_words ⇒ Array
Methods included from Gamefic::Matchable
Instance Method Details
#cap_first ⇒ String
9 10 11 |
# File 'lib/gamefic/core_ext/string.rb', line 9 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.)
5 6 7 |
# File 'lib/gamefic/core_ext/string.rb', line 5 def capitalize_first "#{self[0,1].upcase}#{self[1,self.length]}" end |
#split_words ⇒ Array
13 14 15 |
# File 'lib/gamefic/core_ext/string.rb', line 13 def split_words self.gsub(/ +/, ' ').strip.split end |