# Word helpers.
# Lowercases text and joins its words with sep.
# @param text [String]
# @param sep [String]
# @param max [Integer, nil] cut the slug to this many characters
# @return [String]
slug = text.downcase.scan().join(sep)
max ? slug[0, max].chomp(sep) : slug
end
# @param text [String]
# @return [Hash{String => Integer}]
text.split.map(&:downcase).tally
end
# @param text [String]
# @return [String]
text.split().map(&:capitalize).join
end
text.split.each { yield w }
end
end
end