On Tuesday 28 September 2004 05:44 am, Gavin Sinclair wrote:
> There are two possible factorings.  Have Object#methods return a
> specialised object, thus:
>
>   foo.methods.private
>   foo.methods.all
>   foo.methods.new
>   foo.methods.singleton
>   foo.methods[:new, :protected]   # if you need combination
>   # etc.

For this approach, I think combinations would be better like:

  foo.methods { |m| m.private | m.singleton }
  foo.methods { |m| m.private + m.public }

But I think it might be a bit much to have a whole new class for this. 

Sometimes I really wish symbolic keyed hashes were accessable like object 
methods:

   h = { a: 1, b: 2 }
   h.a  #=> 1
   h.b  #=> 2

That would be sweet. And would make the above possible without a new class. I 
know, method name clash is bad --and there's little one can do to get around 
it. Perhaps alternate notation?

   h:a
   h:b

But I digress.

T.