Sha256: f01e308c51cdf448adc31ac0e5da24176e4880c075c19edd8cf4ca7d3c210227
Contents?: true
Size: 916 Bytes
Versions: 1
Compression:
Stored size: 916 Bytes
Contents
class TestDummy::Loader # == Class Methods ======================================================== def self.load!(model_class) @instance ||= new @instance[model_class.to_s] end # == Instance Methods ===================================================== def initialize @loaded = { } end def [](class_name) return @loaded[class_name] if (@loaded.key?(class_name)) @loaded[class_name] = nil dummy_path = File.expand_path( "#{class_name.to_s.underscore}.rb", TestDummy.dummy_extensions_path ) if (File.exist?(dummy_path)) begin Kernel.load(dummy_path) @loaded[class_name] = true rescue LoadError => e @loaded[class_name] = e end else @loaded[class_name] = false end rescue LoadError => e # Persist that this load attempt failed and don't retry later. @loaded[class_name] = e end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
test_dummy-0.5.0 | lib/test_dummy/loader.rb |