Marc-Andre Lafortune wrote: > I completely agree that we need new methods to do this. Thanks. One idea is name it Enumerable#hash_by (like max_by, group_by) ~~~ User = Struct.new(:id, :name) users = [User.new(1, "Alice"), User.n...yhara (Yutaka HARA)
Now that we can convert 'a list of [key, value] pairs' into a hash with Enumerable#to_h, how about make it take a block to specify 'how to convert each element into a [key, value] pair'? Example: ~~~ # Convert users into an {id ...yhara (Yutaka HARA)
Hi, In the following code, second call of https.get results in an error "Connection reset by peer - SSL_connect" after timeout. --- require "net/https" https = Net::HTTP.new("secure.nicovideo.jp", 443) #https = Net::HTTP.new("ww...yhara (Yutaka HARA)
rdoc of Range#bsearch states "the elements must be sorted", but it does not make sense for Range. Patch: diff --git a/range.c b/range.c index 1e4347e..fab0718 100644 --- a/range.c +++ b/range.c @@ -512,11 +512,10 @@ is_integer_...yhara (Yutaka HARA)
shugo (Shugo Maeda) wrote: > I guess these methods were forgotten to change when lazy was implemented. That's right :-( I thought these methods does not need to be overriden because they return Enumerator, but they should return E...yhara (Yutaka HARA)