Class: Arachni::Support::Database::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/arachni/support/database/base.rb

Overview

This class is abstract.

Base class for Database data structures

Provides helper methods for data structures to be implemented related to objecting dumping, loading, unique filename generation, etc.

Author:

Direct Known Subclasses

Hash, Queue

Instance Method Summary collapse

Constructor Details

#initialize(serializer = Marshal) ⇒ Base

Returns a new instance of Base.

Parameters:

  • serializer (Object) (defaults to: Marshal)

    Any object that responds to 'dump' and 'load'.


24
25
26
27
# File 'lib/arachni/support/database/base.rb', line 24

def initialize( serializer = Marshal )
    @serializer       = serializer
    @filename_counter = 0
end

Instance Method Details

#serialize(obj) ⇒ Object


29
30
31
# File 'lib/arachni/support/database/base.rb', line 29

def serialize( obj )
    compress( serializer.dump( obj ) )
end

#unserialize(data) ⇒ Object


33
34
35
# File 'lib/arachni/support/database/base.rb', line 33

def unserialize( data )
    serializer.load( decompress( data ) )
end