Class: Zxcvbn::Feedback

Inherits:
Data
  • Object
show all
Defined in:
lib/zxcvbn/feedback.rb

Overview

Human-readable feedback for a low-scoring password.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(warning: nil, suggestions: []) ⇒ Feedback

Returns a new instance of Feedback.

Parameters:

  • warning (String) (defaults to: nil)

    warning message (default: empty string)

  • suggestions (Array<String>) (defaults to: [])

    improvement tips (default: [])



13
14
15
# File 'lib/zxcvbn/feedback.rb', line 13

def initialize(warning: nil, suggestions: [])
  super(warning: warning || '', suggestions: suggestions.freeze)
end

Instance Attribute Details

#suggestionsObject (readonly)

Returns the value of attribute suggestions

Returns:

  • (Object)

    the current value of suggestions



10
11
12
13
14
15
16
# File 'lib/zxcvbn/feedback.rb', line 10

Feedback = ::Data.define(:warning, :suggestions) do
  # @param warning [String] warning message (default: empty string)
  # @param suggestions [Array<String>] improvement tips (default: [])
  def initialize(warning: nil, suggestions: [])
    super(warning: warning || '', suggestions: suggestions.freeze)
  end
end

#warningObject (readonly)

Returns the value of attribute warning

Returns:

  • (Object)

    the current value of warning



10
11
12
13
14
15
16
# File 'lib/zxcvbn/feedback.rb', line 10

Feedback = ::Data.define(:warning, :suggestions) do
  # @param warning [String] warning message (default: empty string)
  # @param suggestions [Array<String>] improvement tips (default: [])
  def initialize(warning: nil, suggestions: [])
    super(warning: warning || '', suggestions: suggestions.freeze)
  end
end