Merge commit '87a5e747f'

This commit is contained in:
Tom Preston-Werner
2009-01-02 12:27:25 -08:00
2 changed files with 48 additions and 1 deletions

View File

@@ -19,6 +19,21 @@ module Jekyll
def number_of_words(input)
input.split.length
end
end
def array_to_sentence_string(array)
connector = "and"
case array.length
when 0
""
when 1
array[0].to_s
when 2
"#{array[0]} #{connector} #{array[1]}"
else
"#{array[0...-1].join(', ')}, #{connector} #{array[-1]}"
end
end
end
end