From: Jim Date: 2009-09-04T10:12:41+09:00 Subject: refactor sketchup-ruby code Hello, I need help in understanding how I can factor out some code I posted here: http://sites.google.com/site/jimfoltz/other-stuff I'm a novice but I am experimenting with sketchup observers, and the code near the top has a lot redundancy. The first thing I want to understand is how I can factor out this section: {|m| self.class.send(:define_method, m) {|*a| @c+= 1;puts "#{@c}:#{m}:# { a.inspect }" } } so it only needs edited in a single place, instead of once for each observer. Thanks. Any other constructive comments are appreciated.