ruby/ruby — pull request #580 by Peeja (2014-03-27 21:15:42+00:00)
Title: CSV: Reject nil as a data source.

CSV currently accepts `nil` as a data source, and treats it like an `IO`. Since it's not an `IO`, it blows up in the internals, sometimes much later.

I noticed the issue when I accidentally passed `nil` into `CSV.parse`:

```
irb(main):001:0> CSV.parse(nil)
NoMethodError: undefined method `close' for nil:NilClass
from /Users/peeja/.rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/csv.rb:1293:in `ensure in parse'
from /Users/peeja/.rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/csv.rb:1293:in `parse'
from (irb):1
from /Users/peeja/.rubies/ruby-2.0.0-p353/bin/irb:12:in `

'
```

It took me a while to track down what was going on. This should provide a better message.