Path: blob/master/lib/metasploit/framework/compiler/headers/base.rb
19715 views
module Metasploit1module Framework2module Compiler3module Headers4class Base56attr_accessor :loaded_dep78# Initializes the Base class for headers.9def initialize10# This is used to avoid loading the same dependency code twice11@loaded_dep = []12end1314# Returns the header source code.15#16# @param lib_name [String] The file name of the header.17# @return [String]18def include(lib_name)19lib = lib_dep_map[lib_name]20unless lib21raise RuntimeError, "#{lib_name} not found"22end2324# Load the dependencies first, and only once25dep = ''26lib.each do |f|27unless loaded_dep.include?(f)28dep_path = File.join(headers_path, f)29dep << File.read(dep_path) << "\n"30loaded_dep << f31end32end3334# Load the headers35lib_path = File.join(headers_path, lib_name)36"#{dep}#{File.read(lib_path)}"37end3839end40end41end42end43end4445