Some features:
- avoid calling
require 'monitor.rb' which pulls out a standard monitor instance - run some runtime masks to rename the existing Monitor class.
- monkey from your boot path to
require 'monitor.rb' pull in the empty Monitor implementation.
But in all cases, you may encounter a situation where a third-party library uses Monitor, expecting it to become the standard Monitor class. So, I would advise with none of the above.
I would say that you have only two reasonable options:
A) you can put your class in a namespace:
Module MyApp class Monitor
if your application uses some kind of manual with automatic requirements (for example, an application for rails), then you will add your implementation to / my _app / monitor.rb. When you want to access this class, you will do something like my_monitor = MyApp::Monitor.new() or something else.
B) you can use a different class name :)
Pete hodgson
source share