From 174adc33879b7338d36c29c1c365a1d9015ee626 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Tue, 11 Jan 2011 17:02:31 +0100 Subject: [PATCH] remove obsolete file. --- lib/report/inherited_namespace.rb | 63 ------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 lib/report/inherited_namespace.rb diff --git a/lib/report/inherited_namespace.rb b/lib/report/inherited_namespace.rb deleted file mode 100644 index b95d42531b..0000000000 --- a/lib/report/inherited_namespace.rb +++ /dev/null @@ -1,63 +0,0 @@ -module Report::InheritedNamespace - NESTED_NAMESPACES = %w[Validation Filter GroupBy Result Operator QueryUtils] - - module Hook - def const_missing(name, *) - super - rescue ArgumentError => error - # require 'ruby-debug'; debugger - rescue NameError => error - load_constant name, error - end - end - - def self.activate - Report.extend self - NESTED_NAMESPACES.each { |n| n.extend self } - end - - def inherited(klass) - super - propagate klass - end - - def included(klass) - super - propagate klass - end - - def propagate(klass) - klass.extend Report::InheritedNamespace - klass.extend Hook - return unless klass < Report - NESTED_NAMESPACES.each do |name| - if file = ActiveSupport::Dependencies.search_for_file("#{klass.name}::#{name}".underscore) - require_or_load file - propagate klass.const_get(name) - else - const_missing name - end - end - end - - def load_constant(name, error = NameError) - zuper = (Class === self ? superclass : ancestors.second).const_get(name) - klass = case zuper - when Class then const_set name, Class.new(zuper) - when Module then const_set name, Module.new { include zuper } - else const_set name, zuper - end - propagate klass - klass - rescue NameError, ArgumentError => new_error - if file = ActiveSupport::Dependencies.search_for_file("#{self.name}::#{name}".underscore) - require_or_load file - const_get name - else - error.message << "\n\tWas #{new_error.class}: #{new_error.message}" - new_error.backtrace[0..9].each { |l| error.message << "\n\t\t#{l}" } - error.message << "\n\t\t..." if new_error.backtrace.size > 10 - raise error - end - end -end