From: Reginald Tan Date: 2011-11-02T07:14:51+09:00 Subject: Re: how to make interface explicit with Hash stores? Michael Kohl wrote in post #1029550: > On Tue, Nov 1, 2011 at 3:14 AM, Reginald Tan > wrote: >> I have a class that uses hash as its internal store. What's a good way >> to communicate the interface of my methods. > > Do you need to leak this implementation detail? You could make > add_content a two argument method and changing it like this: > > def add_content(k, v) > @hash.merge(Hash[k,v]) # or @hash.merge({k => v}) > end > > > -- > Michael Kohl > > http://citizen428.net | http://twitter.com/citizen428 That's a good point about hiding implementation. requiring 2 arguments looks like a good way to go about what i'm trying to do. Thanks Michael! -- Posted via http://www.ruby-forum.com/.