Sha256: 3b9c865884b6d8f120647b326822e9881d2c581f84beba880a0363dbb9259456

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

module Luruju

  class JudeApiLoader
    
    @@jude_cache = {}
    
    def self.wrap_load_for_cache jude_file, options={}
      raise ProjectNotFoundException unless FileTest.file?(jude_file)
      return yield(jude_file, options) unless Luruju.config.use_jude_cache
      mtime = File.mtime(jude_file)
      if previous = @@jude_cache[jude_file]
	return previous if previous.mtime == mtime
      end
      loaded = yield jude_file, options
      loaded.mtime = mtime
      @@jude_cache[jude_file] = loaded
      loaded
    end
    
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
luruju-0.2.0 lib/luruju/jude_api_loader_for_cache.rb