Class: BasicObject

Defined in:
lib/cucumber/lib/core_ext/basic_object.rb

Overview

If on Ruby 1.8, create a Sequel::BasicObject class that is similar to the the Ruby 1.9 BasicObject class. This is used in a few places where proxy objects are needed that respond to any method call.

Direct Known Subclasses

OoorProxy, SequelProxy

Constant Summary collapse

KEEP_METHODS =

The instance methods to not remove from the class when removing other methods.

%w"__id__ __send__ __metaclass__ instance_eval == equal? initialize method_missing"

Class Method Summary collapse

Class Method Details

.remove_methods!Object

Remove all but the most basic instance methods from the class. A separate method so that it can be called again if necessary if you load libraries after Sequel that add instance methods to Object.



14
15
16
# File 'lib/cucumber/lib/core_ext/basic_object.rb', line 14

def self.remove_methods!
  ((private_instance_methods + instance_methods) - KEEP_METHODS).each{|m| undef_method(m)}
end