Refactor sketchup-ruby code

Hello,

I need help in understanding how I can factor out some code I posted
here:

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.