Sha256: 98616084d2af0b8537bf86b8ea470134141e489252897fa2ee969697f0fb6ed8

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 Bytes

Contents

module Zeus
  class Server
    class LoadTracking
      class << self
        attr_accessor :server

        def add_feature(file)
          return unless server
          path = if File.exist?(File.expand_path(file))
            File.expand_path(file)
          else
            find_in_load_path(file)
          end
          server.add_extra_feature path if path
        end

        private

        def find_in_load_path(file)
          $LOAD_PATH.map { |path| "#{path}/#{file}" }.detect{ |file| File.exist? file }
        end
      end
    end
  end
end

module Kernel

  def load(file, *a)
    Kernel.load(file, *a)
  end

  class << self
    alias_method :__load_without_zeus, :load
    def load(file, *a)
      Zeus::Server::LoadTracking.add_feature(file)
      __load_without_zeus(file, *a)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zeus-0.4.6 lib/zeus/server/load_tracking.rb
zeus-0.4.5 lib/zeus/server/load_tracking.rb