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
-
#capitalize_first ⇒ String
(also: #cap_first)
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(_index = []) ⇒ Object
Methods included from Gamefic::Keywords
Instance Method Details
#capitalize_first ⇒ String Also known as: cap_first
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.
16 17 18 |
# File 'lib/gamefic/core_ext/string.rb', line 16 def split_words self.gsub(/[\s]+/, ' ').strip.split end |
#to_serial(_index = []) ⇒ Object
149 150 151 |
# File 'lib/gamefic/serialize.rb', line 149 def to_serial(_index = []) self end |