Module: BlankSlate

Included in:
AutoObject, Mocks::Object, VerboseObject
Defined in:
lib/blank_slate.rb

Overview

BlankSlate alter your class and leave you a class with no predefined methods (except for those which begin with _\_. BlankSlate is useful when for a base class which uses method_missing (e.g. dynamic proxies).

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(anObject) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/blank_slate.rb', line 52

def self.extended ( anObject )
  class << anObject
    include ClassMethods
    instance_methods.each do |name|
      next if blank_slate_ignore(name)
      alias_method "__blank_slate_#{name}", name
      undef_method name
    end
  end
end

.included(aClass) ⇒ Object

module ClassMethods



47
48
49
50
# File 'lib/blank_slate.rb', line 47

def self.included ( aClass )
  aClass.extend ClassMethods
  aClass.instance_methods.each { |m| aClass.hide(m) }
end

Instance Method Details

#blank_slate?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/blank_slate.rb', line 24

def blank_slate?
  true
end