test/js/parser.rb
def gather
  return unless select([$stdin], nil, nil, 2)

  lines, line = [], nil
  lines << line while (line = gets) != "---\n"
  lines.join
end
# This function will poll $stdin for 2 seconds and attempt to gather up every
# line until it hits a "---" line. At that point it will return everything
# joined together. If it does not receive input within 2 seconds, it will bail
# out and return `nil`.
This function will poll $stdin for 2 seconds and attempt to gather up every
line until it hits a "---" line. At that point it will return everything
joined together. If it does not receive input within 2 seconds, it will bail
out and return `nil`.
This function will poll $stdin for 2 seconds and attempt to gather up every line until it hits a " --- " line . At that point it will return everything joined together . If it does not receive input within 2 seconds it will bail out and return ` nil ` .
def gather
  return unless select([$stdin], nil, nil, 2)
  lines, line = [], nil
  lines << line while (line = gets) != "---\n"
  lines.join
end
def gather return unless select ( [ $stdin ] , nil , nil , 2 ) lines , line = [ ] , nil lines << line while ( line = gets ) != "---\n" lines . join end
This function will poll $stdin for 2 seconds and attempt to gather up every
line until it hits a "---" line.
This function will poll $stdin for 2 seconds and attempt to gather up every line until it hits a " --- " line .