Module: Kernel

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

.method_added(name) ⇒ Object

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



91
92
93
94
95
96
# File 'lib/directory_template/blank_slate.rb', line 91

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

.template_directory_blank_slate_method_addedObject

Preserve the original method



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

alias template_directory_blank_slate_method_added method_added