Method: NameMagic::ClassMethods.delegate_to_namespace

Defined in:
lib/y_support/name_magic/class_methods.rb

.delegate_to_namespace(*symbols) ⇒ Object

Delegates methods to the namespace used by the class. Since the class frequently acts as its own namespace, this delegation requires special handling.



10
11
12
13
14
15
16
17
# File 'lib/y_support/name_magic/class_methods.rb', line 10

def self.delegate_to_namespace *symbols
  symbols.each { |ß|
    module_eval "def #{ß} *args\n" +
                "  return super if namespace == self\n" +
                "  namespace.#{ß}( *args )\n" +
                "end"
  }
end