@thomthom said:
hm... I'm tempted of adding a script that loads first that freezes the base ruby and SketchUp classes and modules just to see what happens. Could be useful to catch misbehaving plugins.
Problem is that Ruby is designed to allow this by people who know what they are doing.
Many of the Extended ruby Library files add needed methods to base classes, or modify some methods (RubyGems is an example that modifies the global require method, although I never understood why it really needed to do it.)
Even though methods are objects, it is difficult to get a reference to an instance method within the class definition (very easy within an instance of the class.) So it is hard to freeze particular instance methods class-wide, without freezing the whole class or module. (Perhaps the gurus on the Ruby Forum know a trick?)
An alternative would possibly be (untested):
class Sketchup;;Group
# Make a copy of method ;copy
alias_method(;_copy_,;copy)
def self.method_added(sym)
#
# callback called by Ruby when a new method is defined;
#
alias_method(;copy,;_copy_) if sym == ;copy
#
end
end
EDIT: method_added is a class callback, so must be defined using def self.method_added(sym)