[#69084] [Ruby trunk - Feature #11124] [Open] [PATCH] lib/*: use monotonic clock for timeouts — normalperson@...
Issue #11124 has been reported by Eric Wong.
5 messages
2015/05/06
[#69138] [Ruby trunk - Feature #11136] [PATCH] webrick: avoid fcntl module — nobu@...
Issue #11136 has been updated by Nobuyoshi Nakada.
3 messages
2015/05/12
[#69160] [Ruby trunk - Feature #11146] [PATCH] variable.c: initialize generic_iv_tbl at start — nobu@...
Issue #11146 has been updated by Nobuyoshi Nakada.
4 messages
2015/05/13
[#69175] Re: [Ruby trunk - Feature #11146] [PATCH] variable.c: initialize generic_iv_tbl at start
— Eric Wong <normalperson@...>
2015/05/13
nobu@ruby-lang.org wrote:
[ruby-core:69303] [Ruby trunk - Feature #10900] GzipReader does not define `#external_encoding`
From:
djberg96@...
Date:
2015-05-21 16:01:45 UTC
List:
ruby-core #69303
Issue #10900 has been updated by Daniel Berger.
I'd say it should add #encoding and #internal_encoding methods as well, since the constructor supports those options.
----------------------------------------
Feature #10900: GzipReader does not define `#external_encoding`
https://bugs.ruby-lang.org/issues/10900#change-52568
* Author: Aleksandar Kostadinov
* Status: Closed
* Priority: Normal
* Assignee:
----------------------------------------
Hello,
I want to store/load some **yaml** and other text data in gz for space efficiency. I thought it's most efficient to read/write directly to/from a gzip stream. But seems like the **GzipReader** io object does not support everything that a regular file io object does. I spotted the **#external_encoding** method. So for example to load YAML directly from gzip I use the following method:
~~~
def load_yaml_from_gz(gz)
loaded = nil
Zlib::GzipReader.open(gz) do |f|
class << f
def external_encoding
Encoding::UTF_8
end
end
loaded = YAML.load(f, gz)
end
return loaded
end
~~~
I need the monkey-patching because otherwise the YAML.load method fails for no **#external_encoding** method defined.
To avoid monkey patching just to read some text from a gzip archive I propose that GzipReader implements **#external_encoding** the same way as **File** does.
--
https://bugs.ruby-lang.org/