Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [Ruby2]how to dynamically attach :pre :post :wrap ro methods?

Reply
Thread Tools

[Ruby2]how to dynamically attach :pre :post :wrap ro methods?

 
 
gabriele renzi
Guest
Posts: n/a
 
      06-01-2004
Hi gurus and nubys,

Loooking forward to the syntax

def foore
end

I wonder: could we add preconditions without resorting to syntax?

Would we have something like this:

myobj.methods.each do |m|
m.wrap(re) {|*args| p args }
end

?
Sounds obvious and necessary to me, but I can't remeber talks about
this..


TIA
 
Reply With Quote
 
 
 
 
Mauricio Fernández
Guest
Posts: n/a
 
      06-01-2004
On Wed, Jun 02, 2004 at 03:53:41AM +0900, gabriele renzi wrote:
> Would we have something like this:
>
> myobj.methods.each do |m|
> m.wrap(re) {|*args| p args }
> end
>
> ?
> Sounds obvious and necessary to me, but I can't remeber talks about
> this..


See
http://blade.nagaokaut.ac.jp/cgi-bin...uby-talk/97440

Something similar can be implemented trivially using the same principle,
with Object#method instead of Module#instance_method and using the
singleton class.

--
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

...Deep Hack Mode -- that mysterious and frightening state of
consciousness where Mortal Users fear to tread.
-- Matt Welsh


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any shortcut for "Debug > Attach > Attach to aspnet_wp.exe"? Warren Tang ASP .Net 1 09-17-2008 03:46 PM
attach agent to applet running in firefox (attach api) craiget@gmail.com Java 0 06-14-2007 12:28 AM
Dynamically attach a property value to input element Fabio Cavassini Javascript 1 01-24-2006 12:48 PM
How to attach an event to dynamically created control in VB.NET =?Utf-8?B?TmlybWFsa3VtYXI=?= ASP .Net 1 01-12-2005 03:05 PM
dynamically generate script block and attach to event Nikhil Patel ASP .Net 3 10-07-2004 09:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57