Module: Ronin::Repos::ClassDir

Defined in:
lib/ronin/repos/class_dir.rb

Overview

Adds the ability to load classes from directories within installed repositories.

Example

lib/ronin/exploits.rb:

require 'ronin/core/module_registry'
require 'ronin/repos/class_dir'

module Ronin
  module Exploits
    include Ronin::Core::ClassRegistry
    include Ronin::Repos::ClassDir

    class_dir "#{__dir__}/classes"
    repo_class_dir "exploits"
  end
end

lib/ronin/exploits/exploit.rb:

module Ronin
  module Exploits
    class Exploit

      def self.register(name)
        Exploits.register(name,self)
      end

    end
  end
end

~/.cache/ronin-repos/repo1/exploits/my_exploit.rb:

require 'ronin/exploits/exploit'

module Ronin
  module Exploits
    class MyExploit < Exploit

      register 'my_exploit'

    end
  end
end

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(namespace) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Includes Ronin::Core::ClassRegistry and adds ClassMethods.

Parameters:



86
87
88
89
# File 'lib/ronin/repos/class_dir.rb', line 86

def self.included(namespace)
  namespace.send :include, Core::ClassRegistry
  namespace.extend ClassMethods
end