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 Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
Instance Method Summary collapse
-
#<<(item) ⇒ HashSet
(also: #add)
‘self`.
- #==(other) ⇒ Object
- #any? ⇒ Boolean
- #clear ⇒ Object
-
#delete(item) ⇒ HashSet
‘self`.
- #dup ⇒ Object
- #empty? ⇒ Boolean
- #hash ⇒ Object
- #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.
27 28 29 30 |
# File 'lib/arachni/support/lookup/base.rb', line 27 def initialize( = {} ) @options = DEFAULT_OPTIONS.merge( ) @hasher = @options[:hasher].to_sym end |
Instance Attribute Details
#collection ⇒ Object
Returns the value of attribute collection.
18 19 20 |
# File 'lib/arachni/support/lookup/base.rb', line 18 def collection @collection end |
Instance Method Details
#<<(item) ⇒ HashSet Also known as: add
Returns ‘self`.
37 38 39 40 |
# File 'lib/arachni/support/lookup/base.rb', line 37 def <<( item ) @collection << calculate_hash( item ) self end |
#==(other) ⇒ Object
77 78 79 |
# File 'lib/arachni/support/lookup/base.rb', line 77 def ==( other ) hash == other.hash end |
#any? ⇒ Boolean
65 66 67 |
# File 'lib/arachni/support/lookup/base.rb', line 65 def any? !empty? end |
#clear ⇒ Object
73 74 75 |
# File 'lib/arachni/support/lookup/base.rb', line 73 def clear @collection.clear end |
#delete(item) ⇒ HashSet
Returns ‘self`.
48 49 50 51 |
# File 'lib/arachni/support/lookup/base.rb', line 48 def delete( item ) @collection.delete( calculate_hash( item ) ) self end |
#dup ⇒ Object
85 86 87 |
# File 'lib/arachni/support/lookup/base.rb', line 85 def dup self.class.new( @options.dup ).tap { |c| c.collection = @collection.dup } end |
#empty? ⇒ Boolean
61 62 63 |
# File 'lib/arachni/support/lookup/base.rb', line 61 def empty? @collection.empty? end |
#hash ⇒ Object
81 82 83 |
# File 'lib/arachni/support/lookup/base.rb', line 81 def hash @collection.hash end |
#include?(item) ⇒ Bool
57 58 59 |
# File 'lib/arachni/support/lookup/base.rb', line 57 def include?( item ) @collection.include? calculate_hash( item ) end |
#size ⇒ Object
69 70 71 |
# File 'lib/arachni/support/lookup/base.rb', line 69 def size @collection.size end |