Refactor sketchup-ruby code


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

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

{|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

Thanks. Any other constructive comments are appreciated.