GzipReader each_line method missing in Rubinius

283 views Asked by At

I am trying to read a gzipped file using Zlib:GzipReader. This works as expected using ruby 1.9.3 but I am getting a method_missing error for each_line when using Rubinius.

Is there any way to read a gzipped file using Rubinius?

require 'zlib'

Zlib::GzipReader.open("lines.txt.gz").each_line { |line|
  puts "#{line}"
}

Kernel(Zlib::GzipReader)#each_line (method_missing) at kernel/delta/kernel.rb:81
1

There are 1 answers

1
Eugene On BEST ANSWER

I believe this is a bug in Rubinius, you should consider opening an issue for it with the project. However, this workaround should get you going:

require 'zlib'
require 'stringio'

file = File.read("lines.txt.gz")
lines = Zlib::GzipReader.new(StringIO.new(file)).read