Class: DumpCleaner::Cleanup::Uniqueness::CaseInsensitiveCache
- Inherits:
-
Object
- Object
- DumpCleaner::Cleanup::Uniqueness::CaseInsensitiveCache
- Includes:
- Singleton
- Defined in:
- lib/dump_cleaner/cleanup/uniqueness.rb
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize ⇒ CaseInsensitiveCache
constructor
A new instance of CaseInsensitiveCache.
- #known?(type:, value:) ⇒ Boolean
- #push(type:, value:) ⇒ Object
Constructor Details
#initialize ⇒ CaseInsensitiveCache
Returns a new instance of CaseInsensitiveCache.
45 46 47 |
# File 'lib/dump_cleaner/cleanup/uniqueness.rb', line 45 def initialize clear end |
Instance Method Details
#clear ⇒ Object
49 50 51 |
# File 'lib/dump_cleaner/cleanup/uniqueness.rb', line 49 def clear @data = {} end |
#known?(type:, value:) ⇒ Boolean
53 54 55 56 57 |
# File 'lib/dump_cleaner/cleanup/uniqueness.rb', line 53 def known?(type:, value:) return false unless @data.key?(type) @data[type].include?(value.downcase) end |
#push(type:, value:) ⇒ Object
59 60 61 62 |
# File 'lib/dump_cleaner/cleanup/uniqueness.rb', line 59 def push(type:, value:) @data[type] ||= Set.new @data[type].add(value.downcase) end |