Class: Arachni::Support::LookUp::Moolb
- Defined in:
- lib/arachni/support/lookup/moolb.rb
Overview
Opposite of Bloom a filter, ergo Moolb.
Basically a cache used for look-up operations.
Constant Summary collapse
- DEFAULT_OPTIONS =
{ strategy: Support::Cache::RandomReplacement, max_size: 100_000 }
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#<<(item) ⇒ HashSet
(also: #add)
‘self`.
-
#initialize(options = {}) ⇒ Moolb
constructor
A new instance of Moolb.
Methods inherited from Base
#==, #any?, #clear, #delete, #dup, #empty?, #hash, #include?, #size
Constructor Details
#initialize(options = {}) ⇒ Moolb
Returns a new instance of Moolb.
34 35 36 37 38 39 |
# File 'lib/arachni/support/lookup/moolb.rb', line 34 def initialize( = {} ) super( ) @options.merge!( DEFAULT_OPTIONS.merge( ) ) @collection = @options[:strategy].new( @options[:max_size] ) end |
Instance Method Details
#<<(item) ⇒ HashSet Also known as: add
Returns ‘self`.
46 47 48 49 |
# File 'lib/arachni/support/lookup/moolb.rb', line 46 def <<( item ) @collection[calculate_hash( item )] = true self end |