Module: Hardmock::MethodCleanout

Included in:
Expector, Mock, Trapper
Defined in:
lib/hardmock/method_cleanout.rb

Overview

:nodoc:

Constant Summary collapse

SACRED_METHODS =
%w{
  __id__
  __send__
  equal?
  object_id
  send
  nil?
  class
  kind_of?
  respond_to?
  inspect
  method
  to_s
  instance_variables
  instance_eval
  ==
  hm_metaclass
  hm_meta_eval
  hm_meta_def
}

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



25
26
27
28
29
30
31
# File 'lib/hardmock/method_cleanout.rb', line 25

def self.included(base) #:nodoc:
  base.class_eval do
    instance_methods.each do |m| 
      undef_method m unless SACRED_METHODS.include?(m.to_s)
    end
  end
end