class String
Public Instance Methods
capitalize_first()
click to toggle source
Capitalize the first letter without changing the rest of the string. (String#capitalize makes the rest of the string lower-case.)
@return [String] The capitalized text
# File lib/gamefic/core_ext/string.rb, line 8 def capitalize_first "#{self[0, 1].upcase}#{self[1, length]}" end
Also aliased as: cap_first
keywords()
click to toggle source
Get an array of words split by any whitespace.
@return [Array]
# File lib/gamefic/core_ext/string.rb, line 16 def keywords gsub(/[\s-]+/, ' ').strip.downcase.split - %w[a an the] end
normalize()
click to toggle source
@return [String]
# File lib/gamefic/core_ext/string.rb, line 21 def normalize keywords.join(' ') end