title: IOError: closed stream in irb
body: <pre><code>File.open("/tmp/test") do |file|
    file.each_line("e") {|line|
      puts "Got #{ line.dump }"
    }
  end
  </code></pre>
  
  <p>returns "IOError: closed stream" in irb. But if is is saved in file 'test.rb', <code>ruby test.rb</code> - works fine. Ruby versions: ruby-2.0.0-p247, ruby-2.1.0-preview1, Ubuntu, Mac OS. What do I wrongly?</p>
  
  <pre><code>user:ads user$ echo "a\nb\nc" &gt; /tmp/test
  user:ads user$ irb
  2.1.0-preview1 :001 &gt; File.open("/tmp/test") { |file| file.each_line { |line| puts "Got #{ line.dump }" } }
  Got "a\\nb\\nc\n"
  IOError: closed stream
      from /Users/user/.rvm/gems/ruby-2.1.0-preview1/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:199:in `directory?'
      from /Users/user/.rvm/gems/ruby-2.1.0-preview1/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:199:in `awesome_file'
      from /Users/user/.rvm/gems/ruby-2.1.0-preview1/gems/awesome_print-1.2.0/lib/awesome_print/formatter.rb:26:in `format'
      from /Users/user/.rvm/gems/ruby-2.1.0-preview1/gems/awesome_print-1.2.0/lib/awesome_print/inspector.rb:137:in `unnested'
      from /Users/user/.rvm/gems/ruby-2.1.0-preview1/gems/awesome_print-1.2.0/lib/awesome_print/inspector.rb:104:in `awesome'
      from /Users/user/.rvm/gems/ruby-2.1.0-preview1/gems/awesome_print-1.2.0/lib/awesome_print/core_ext/kernel.rb:10:in `ai'
      from /Users/user/.rvm/gems/ruby-2.1.0-preview1/gems/awesome_print-1.2.0/lib/awesome_print/core_ext/kernel.rb:20:in `ap'
      from /Users/user/.irbrc:7:in `output_value'
      from /Users/user/.rvm/rubies/ruby-2.1.0-preview1/bin/irb:15:in `&lt;main&gt;'
  </code></pre>