rdp / google_hash

wrapper for google's hash functions, for ruby
BSD 3-Clause "New" or "Revised" License
92 stars 16 forks source link

Ruby hash methods. #30

Open YvanDaSilva opened 9 years ago

YvanDaSilva commented 9 years ago

Hello,

Nice gem, I was wondering if you could add more ruby hash methods ? http://www.ruby-doc.org/core-2.1.5/Hash.html

each_pair etc.

Best regards, Yvan.

rdp commented 9 years ago

which methods exactly? I usually don't implement things unless people actually need/want them :) each_pair you already have with #each I think

On Tue, Dec 16, 2014 at 4:27 AM, Yvan Da Silva notifications@github.com wrote:

Hello,

Nice gem, I was wondering if you could add more ruby hash methods ? http://www.ruby-doc.org/core-2.1.5/Hash.html

each_pair etc.

Best regards, Yvan.

— Reply to this email directly or view it on GitHub https://github.com/rdp/google_hash/issues/30.

YvanDaSilva commented 9 years ago

Hello @rdp,

Yes, you do have each instead of each_pair but it does not match the "Hash" spec from ruby. Since this implementation is supposed to replace the Hash of Ruby shouldn't it also include all its methods?

It is just a matter of re-using existing code without having to go through many function call changes.

I do understand if you have limited time and do not want to provide such method, as I do not have time myself to implement them.

rdp commented 9 years ago

gotcha, yeah that's a good idea, I will leave this open to remind me. If there are any pain points [methods you use that you had to refactor to use google_hash] let me know of them as well, thanks!

YvanDaSilva commented 9 years ago

Good idea.

No the refractor was minimal on my side, but I don't except my team to refractor their own part to use this gem as they will expect it would be a full replacement.

maasha commented 9 years ago

Google Hash should include Enumerable.

rdp commented 9 years ago

Enumerable might be a little more tricky, though with the #keys method it returns an array which is enumerable'ish, FWIW. Anyway added each_pair in 0.8.7 feel free to call out other methods and I'll add them if it's straight forward enough :) Leaving this open for now as a bookmark reminder that some things are missing. Thanks! -roger-

On Mon, Mar 23, 2015 at 6:11 AM, maasha notifications@github.com wrote:

Really, Ghash should include Enumerable.

— Reply to this email directly or view it on GitHub https://github.com/rdp/google_hash/issues/30#issuecomment-84967598.

maasha commented 9 years ago

I was just sorely missing the wonders of the methods each_with_index and each_with_object!