lib/services/keyword_generator_service.rb
def fill_buffer
      lines = File.readlines('/usr/share/dict/words')

      @keyword_buffer.clear
      20.times do
        @keyword_buffer.push(lines.sample.strip)
      end
    end
# Buffer is filled with 20 random words, to reduce the amount
# of time spent doing IO related operations.
#
# When buffer is fully consumed, another 20 random words are
# fetched.
Buffer is filled with 20 random words, to reduce the amount
of time spent doing IO related operations.

When buffer is fully consumed, another 20 random words are
fetched.
Buffer is filled with 20 random words to reduce the amount of time spent doing IO related operations . When buffer is fully consumed another 20 random words are fetched .
def fill_buffer
      lines = File.readlines('/usr/share/dict/words')
      @keyword_buffer.clear
      20.times do
        @keyword_buffer.push(lines.sample.strip)
      end
    end
def fill_buffer lines = File . readlines ( '/usr/share/dict/words' ) @keyword_buffer . clear 20 . times do @keyword_buffer . push ( lines . sample . strip ) end end
Buffer is filled with 20 random words, to reduce the amount
of time spent doing IO related operations.
Buffer is filled with 20 random words to reduce the amount of time spent doing IO related operations .