Forum: Ruby Re: Are my metaprogramming underpants showing?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
daniels (Guest)
on 2005-12-08 23:06
(Received via mailing list)
> Given that the code below is functionally equivalent, what's
> beneficial about using a lambda expression?  It strikes me as a
> requirement imposed by using the Functor class more than anything.

The class way is definitely the way to go, as it gives you easier
flexibility. I was just in a lamdba mood at the time I wrote it and
couldn't be bothered making it into a class.

You might want to do this:

class Flickr
  instance_methods.each {|x| remove_method(x) unless /__.*__/ === x }
end

To prevent any conflict between flickr methods and ruby object methods.








#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################
M.B.Smillie (Guest)
on 2005-12-09 02:18
(Received via mailing list)
On Dec 8, 2005, at 21:05, Daniel S. wrote:


>
> class Flickr
>   instance_methods.each {|x| remove_method(x) unless /__.*__/ === x }
> end
>
> To prevent any conflict between flickr methods and ruby object
> methods.
>

Good idea, since a conflict would break the whole thing.

Thanks again to you and Trans for the feedback.

matthew smillie.
This topic is locked and can not be replied to.