Module: Ronin::Core::ClassRegistry

Defined in:
lib/ronin/core/class_registry.rb

Overview

A mixin that adds a class registry to a library:

Example

lib/ronin/exploits.rb:

require 'ronin/core/class_registry'

module Ronin
  module Exploits
    include Ronin::Core::ClassRegistry

    class_dir "#{__dir__}/classes"
  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

lib/ronin/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 Classes: ClassNotFound

Class Method Summary collapse

Class Method Details

.included(namespace) ⇒ Object

Extends ClassMethods.

Parameters:



78
79
80
# File 'lib/ronin/core/class_registry.rb', line 78

def self.included(namespace)
  namespace.extend ClassMethods
end