Class: String
- Includes:
- Gamefic::Keywords
- Defined in:
- lib/gamefic/serialize.rb,
lib/gamefic/core_ext/string.rb
Constant Summary
Constants included from Gamefic::Keywords
Gamefic::Keywords::SPLIT_REGEXP
Instance Method Summary collapse
-
#cap_first ⇒ String
An alias for #capitalize_first.
-
#capitalize_first ⇒ String
Capitalize the first letter without changing the rest of the string.
-
#split_words ⇒ Array
Get an array of words split by any whitespace.
- #to_serial ⇒ Object
Methods included from Gamefic::Keywords
Instance Method Details
#cap_first ⇒ String
An alias for #capitalize_first.
15 16 17 |
# File 'lib/gamefic/core_ext/string.rb', line 15 def cap_first self.capitalize_first end |
#capitalize_first ⇒ String
Capitalize the first letter without changing the rest of the string. (String#capitalize makes the rest of the string lower-case.)
8 9 10 |
# File 'lib/gamefic/core_ext/string.rb', line 8 def capitalize_first "#{self[0,1].upcase}#{self[1,self.length]}" end |
#split_words ⇒ Array
Get an array of words split by any whitespace.
22 23 24 |
# File 'lib/gamefic/core_ext/string.rb', line 22 def split_words self.gsub(/[\s]+/, ' ').strip.split end |
#to_serial ⇒ Object
36 37 38 |
# File 'lib/gamefic/serialize.rb', line 36 def to_serial self end |