Reputation: 6689
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
Upvotes: 0
Views: 288
Reputation: 4879
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
Upvotes: 1