Class: Arachni::Support::LookUp::Base Abstract
- Defined in:
- lib/arachni/support/lookup/base.rb
Overview
This class is abstract.
Constant Summary collapse
- DEFAULT_OPTIONS =
{ hasher: :hash }
Instance Method Summary collapse
-
#<<(item) ⇒ HashSet
(also: #add)
Self.
- #clear ⇒ Object
-
#delete(item) ⇒ HashSet
Self.
- #empty? ⇒ Boolean
- #include?(item) ⇒ Bool
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #size ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
35 36 37 38 |
# File 'lib/arachni/support/lookup/base.rb', line 35 def initialize( = {} ) @options = DEFAULT_OPTIONS.merge( ) @hasher = @options[:hasher].to_sym end |
Instance Method Details
#<<(item) ⇒ HashSet Also known as: add
Returns self.
45 46 47 48 |
# File 'lib/arachni/support/lookup/base.rb', line 45 def <<( item ) @collection << calculate_hash( item ) self end |
#clear ⇒ Object
78 79 80 |
# File 'lib/arachni/support/lookup/base.rb', line 78 def clear @collection.clear end |
#delete(item) ⇒ HashSet
Returns self.
56 57 58 59 |
# File 'lib/arachni/support/lookup/base.rb', line 56 def delete( item ) @collection.delete( calculate_hash( item ) ) self end |
#empty? ⇒ Boolean
70 71 72 |
# File 'lib/arachni/support/lookup/base.rb', line 70 def empty? @collection.empty? end |
#include?(item) ⇒ Bool
66 67 68 |
# File 'lib/arachni/support/lookup/base.rb', line 66 def include?( item ) @collection.include? calculate_hash( item ) end |
#size ⇒ Object
74 75 76 |
# File 'lib/arachni/support/lookup/base.rb', line 74 def size @collection.size end |