Module: DevBall::PkgSpec
- Defined in:
- lib/devball/pkgspec/djb.rb,
lib/devball/pkgspec/gem.rb,
lib/devball/pkgspec/base.rb,
lib/devball/pkgspec/pecl.rb,
lib/devball/pkgspec/simple_dir.rb
Defined Under Namespace
Classes: Base, BuildFailed, ConfigureFailed, Djb, Error, ExtractFailed, Gem, InstallFailed, PackageLoadError, Pecl, RemoveFailed, SimpleDir, Undefined
Class Method Summary collapse
-
.const_missing(name) ⇒ Object
Autoload arbitrary devball pkgspec-types through const_missing.
Class Method Details
.const_missing(name) ⇒ Object
Autoload arbitrary devball pkgspec-types through const_missing
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/devball/pkgspec/base.rb', line 28 def self.const_missing(name) autoloading = (Thread.current[:autoloading] ||= {}) if (autoloading[name]) raise NameError, "uninitialized constant DevBall::PkgSpec::#{name} (autoload already tried to find it)" end autoloading[name] = true begin filename = name.to_s.gsub(/^[A-Z]/) {|a| a.downcase }.gsub(/[A-Z]/) {|a| "_#{a.downcase}" } require 'devball/pkgspec/' + filename if (!const_defined?(name)) raise NameError, "uninitialized constant DevBall::PkgSpec::#{name} (autoload found file but file did not define class)" end return const_get(name) rescue LoadError raise NameError, "uninitialized constant DevBall::PkgSpec::#{name} (autoload failed to find matching file)" ensure autoloading[name] = false end end |