Class: Zxcvbn::Matchers::Dictionary Private
- Inherits:
-
Object
- Object
- Zxcvbn::Matchers::Dictionary
- Defined in:
- lib/zxcvbn/matchers/dictionary.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Matches any sequential segment of the lowercased password that appears in a ranked dictionary.
Instance Method Summary collapse
-
#initialize(name, ranked_dictionary, trie = nil) ⇒ Dictionary
constructor
private
A new instance of Dictionary.
-
#matches(password) ⇒ Array<MatchBuilder>
private
Returns all dictionary matches found in password.
Constructor Details
#initialize(name, ranked_dictionary, trie = nil) ⇒ Dictionary
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Dictionary.
14 15 16 17 18 |
# File 'lib/zxcvbn/matchers/dictionary.rb', line 14 def initialize(name, ranked_dictionary, trie = nil) @name = name @ranked_dictionary = ranked_dictionary @trie = trie end |
Instance Method Details
#matches(password) ⇒ Array<MatchBuilder>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns all dictionary matches found in password.
24 25 26 27 28 29 30 31 32 |
# File 'lib/zxcvbn/matchers/dictionary.rb', line 24 def matches(password) lowercased_password = password.downcase if @trie trie_matches(password, lowercased_password) else hash_matches(password, lowercased_password) end end |