Class: Object

Inherits:
BasicObject
Defined in:
lib/directory_template/blank_slate.rb

Overview

Extensions to Object for DirectoryTemplate::BlankSlate. Since Ruby is very dynamic, methods added to the ancestors of DirectoryTemplate::BlankSlate after BlankSlate is defined will show up in the list of available BlankSlate methods. We handle this by defining a hook in the Object and Kernel classes that will hide any method defined after BlankSlate has been loaded.

Class Method Summary collapse

Class Method Details

.find_hidden_method(name) ⇒ Object

See DirectoryTemplate::BlankSlate::find_hidden_method This just serves as a stopper/terminator of the lookup chain.



125
126
127
# File 'lib/directory_template/blank_slate.rb', line 125

def self.find_hidden_method(name)
  nil
end

.method_added(name) ⇒ Object

Detect method additions to Object and remove them in the BlankSlate class.



115
116
117
118
119
120
# File 'lib/directory_template/blank_slate.rb', line 115

def self.method_added(name)
  result = template_directory_blank_slate_method_added(name)
  return result if self != Object
  DirectoryTemplate::BlankSlate.hide(name)
  result
end

.template_directory_blank_slate_method_addedObject

Preserve the original method



109
# File 'lib/directory_template/blank_slate.rb', line 109

alias template_directory_blank_slate_method_added method_added