How can I do some functions in Ruby : In ruby
Using the oliver.txt ---> http://hills.ccsf.edu/~dputnam/oliver.txt

write a function called count_paragraphs() that counts the number of paragraphs in the text.
In oliver.txt the paragraph delimiter consists of two or more consecutive newline characters, like this: \n\n, \n\n\n, or even \n\n\n\n.
Your function should return either the number of paragraphs or nil.

I have this code but it doesn't work:

    def count_paragraphs(some_file)
    file_content = open(some_file).read()
    count = 0
    file_content_split = file_content.split('')

    file_content_split.each_index do |index|
    count += 1 if file_content_split[index] == "\n" &&
    file_content_split[index + 1] == "\n"                      
    end
    return count
    end

   # test code

p count_paragraphs("oliver.txt")