Class: Zxcvbn::MatchBuilder Private

Inherits:
Struct
  • Object
show all
Defined in:
lib/zxcvbn/match_builder.rb,
sig/zxcvbn/match_builder.rbs

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.

Mutable accumulator for match attributes. Matchers populate a builder incrementally; #build seals it into an immutable Match.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMatchBuilder

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 MatchBuilder.

Parameters:

  • pattern: (String, nil)
  • i: (Integer, nil)
  • j: (Integer, nil)
  • token: (String, nil)
  • matched_word: (String, nil)
  • rank: (Integer, nil)
  • dictionary_name: (String, nil)
  • reversed: (Boolean, nil)
  • l33t: (Boolean, nil)
  • sub: (Hash[String, String], nil)
  • sub_display: (String, nil)
  • guesses: (Numeric, nil)
  • guesses_log10: (Float, nil)
  • base_guesses: (Numeric, nil)
  • uppercase_variations: (Numeric, nil)
  • l33t_variations: (Numeric, nil)
  • base_token: (String, nil)
  • repeat_count: (Integer, nil)
  • sequence_name: (String, nil)
  • sequence_space: (Integer, nil)
  • ascending: (Boolean, nil)
  • graph: (String, nil)
  • turns: (Integer, nil)
  • shifted_count: (Integer, nil)
  • year: (Integer, nil)
  • month: (Integer, nil)
  • day: (Integer, nil)
  • separator: (String, nil)


32
# File 'sig/zxcvbn/match_builder.rbs', line 32

def initialize: (?pattern: String?, ?i: Integer?, ?j: Integer?, ?token: String?, ?matched_word: String?, ?rank: Integer?, ?dictionary_name: String?, ?reversed: bool?, ?l33t: bool?, ?sub: Hash[String, String]?, ?sub_display: String?, ?guesses: Numeric?, ?guesses_log10: Float?, ?base_guesses: Numeric?, ?uppercase_variations: Numeric?, ?l33t_variations: Numeric?, ?base_token: String?, ?repeat_count: Integer?, ?sequence_name: String?, ?sequence_space: Integer?, ?ascending: bool?, ?graph: String?, ?turns: Integer?, ?shifted_count: Integer?, ?year: Integer?, ?month: Integer?, ?day: Integer?, ?separator: String?) -> void

Instance Attribute Details

#ascendingBoolean?

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:

  • (Boolean, nil)


23
24
25
# File 'sig/zxcvbn/match_builder.rbs', line 23

def ascending
  @ascending
end

#base_guessesNumeric?

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:

  • (Numeric, nil)


16
17
18
# File 'sig/zxcvbn/match_builder.rbs', line 16

def base_guesses
  @base_guesses
end

#base_tokenString?

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:

  • (String, nil)


19
20
21
# File 'sig/zxcvbn/match_builder.rbs', line 19

def base_token
  @base_token
end

#dayInteger?

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:

  • (Integer, nil)


29
30
31
# File 'sig/zxcvbn/match_builder.rbs', line 29

def day
  @day
end

#dictionary_nameString?

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:

  • (String, nil)


9
10
11
# File 'sig/zxcvbn/match_builder.rbs', line 9

def dictionary_name
  @dictionary_name
end

#graphString?

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:

  • (String, nil)


24
25
26
# File 'sig/zxcvbn/match_builder.rbs', line 24

def graph
  @graph
end

#guessesNumeric?

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:

  • (Numeric, nil)


14
15
16
# File 'sig/zxcvbn/match_builder.rbs', line 14

def guesses
  @guesses
end

#guesses_log10Float?

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:

  • (Float, nil)


15
16
17
# File 'sig/zxcvbn/match_builder.rbs', line 15

def guesses_log10
  @guesses_log10
end

#iInteger?

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:

  • (Integer, nil)


4
5
6
# File 'sig/zxcvbn/match_builder.rbs', line 4

def i
  @i
end

#jInteger?

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:

  • (Integer, nil)


5
6
7
# File 'sig/zxcvbn/match_builder.rbs', line 5

def j
  @j
end

#l33tBoolean?

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:

  • (Boolean, nil)


11
12
13
# File 'sig/zxcvbn/match_builder.rbs', line 11

def l33t
  @l33t
end

#l33t_variationsNumeric?

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:

  • (Numeric, nil)


18
19
20
# File 'sig/zxcvbn/match_builder.rbs', line 18

def l33t_variations
  @l33t_variations
end

#matched_wordString?

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:

  • (String, nil)


7
8
9
# File 'sig/zxcvbn/match_builder.rbs', line 7

def matched_word
  @matched_word
end

#monthInteger?

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:

  • (Integer, nil)


28
29
30
# File 'sig/zxcvbn/match_builder.rbs', line 28

def month
  @month
end

#patternString?

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:

  • (String, nil)


3
4
5
# File 'sig/zxcvbn/match_builder.rbs', line 3

def pattern
  @pattern
end

#rankInteger?

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:

  • (Integer, nil)


8
9
10
# File 'sig/zxcvbn/match_builder.rbs', line 8

def rank
  @rank
end

#repeat_countInteger?

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:

  • (Integer, nil)


20
21
22
# File 'sig/zxcvbn/match_builder.rbs', line 20

def repeat_count
  @repeat_count
end

#reversedBoolean?

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:

  • (Boolean, nil)


10
11
12
# File 'sig/zxcvbn/match_builder.rbs', line 10

def reversed
  @reversed
end

#separatorString?

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:

  • (String, nil)


30
31
32
# File 'sig/zxcvbn/match_builder.rbs', line 30

def separator
  @separator
end

#sequence_nameString?

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:

  • (String, nil)


21
22
23
# File 'sig/zxcvbn/match_builder.rbs', line 21

def sequence_name
  @sequence_name
end

#sequence_spaceInteger?

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:

  • (Integer, nil)


22
23
24
# File 'sig/zxcvbn/match_builder.rbs', line 22

def sequence_space
  @sequence_space
end

#shifted_countInteger?

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:

  • (Integer, nil)


26
27
28
# File 'sig/zxcvbn/match_builder.rbs', line 26

def shifted_count
  @shifted_count
end

#subHash[String, String]?

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:

  • (Hash[String, String], nil)


12
13
14
# File 'sig/zxcvbn/match_builder.rbs', line 12

def sub
  @sub
end

#sub_displayString?

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:

  • (String, nil)


13
14
15
# File 'sig/zxcvbn/match_builder.rbs', line 13

def sub_display
  @sub_display
end

#tokenString?

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:

  • (String, nil)


6
7
8
# File 'sig/zxcvbn/match_builder.rbs', line 6

def token
  @token
end

#turnsInteger?

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:

  • (Integer, nil)


25
26
27
# File 'sig/zxcvbn/match_builder.rbs', line 25

def turns
  @turns
end

#uppercase_variationsNumeric?

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:

  • (Numeric, nil)


17
18
19
# File 'sig/zxcvbn/match_builder.rbs', line 17

def uppercase_variations
  @uppercase_variations
end

#yearInteger?

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:

  • (Integer, nil)


27
28
29
# File 'sig/zxcvbn/match_builder.rbs', line 27

def year
  @year
end

Instance Method Details

#buildMatch

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 immutable match with the current attribute values.

Returns:

  • (Match)

    immutable match with the current attribute values



11
12
13
# File 'lib/zxcvbn/match_builder.rb', line 11

def build
  Match.new(**to_h.tap { |h| h[:sub]&.freeze })
end