Sha256: fa5bc2230772f176656984280036425a31072812aa8f7ebca1f8e9d3ba727629
Contents?: true
Size: 337 Bytes
Versions: 12
Compression:
Stored size: 337 Bytes
Contents
class StringHelper def self.to_title(s) small_words = %w{a an and the or for of nor} title_words = [] s.split('_').each_with_index do |word, i| word.capitalize! unless small_words.include?(word) word.capitalize! if i == 0 title_words.push(word) end title_words.join(' ') end end
Version data entries
12 entries across 12 versions & 1 rubygems