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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs