From: Dave Thomas Date: 2000-12-23T15:23:31+09:00 Subject: [ruby-talk:7995] Re: defined? problem? Dave Thomas writes: > Now if you want real testosterone-loaded statement modifiers, how > about... Or, as I just discovered, you can use statement modifiers on class and method definitions. How about adding debugging to arrays if you specify -d on the command line? class Array alias_method :old_access, :[] def [](*args) res = old_access(*args) puts "arr[#{args.join(', ')}] => #{res.to_a.join(', ')}" res end end if $DEBUG # <<<<< a = [1,2,3,4] p a[3] p a[1..2] => arr[3] => 4 4 arr[1..2] => 2, 3 [2, 3] Now, can anyone find a use for tacking a 'while' modifier on to a class or method definition? Dave