Class: PassForge::Analyzer::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/passforge/analyzer.rb

Overview

Analysis result object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(password:, score:, entropy:, crack_time:, strength:, suggestions:) ⇒ Result

Returns a new instance of Result.



11
12
13
14
15
16
17
18
# File 'lib/passforge/analyzer.rb', line 11

def initialize(password:, score:, entropy:, crack_time:, strength:, suggestions:)
  @password = password
  @score = score
  @entropy = entropy
  @crack_time = crack_time
  @strength = strength
  @suggestions = suggestions
end

Instance Attribute Details

#crack_timeObject (readonly)

Returns the value of attribute crack_time.



9
10
11
# File 'lib/passforge/analyzer.rb', line 9

def crack_time
  @crack_time
end

#entropyObject (readonly)

Returns the value of attribute entropy.



9
10
11
# File 'lib/passforge/analyzer.rb', line 9

def entropy
  @entropy
end

#passwordObject (readonly)

Returns the value of attribute password.



9
10
11
# File 'lib/passforge/analyzer.rb', line 9

def password
  @password
end

#scoreObject (readonly)

Returns the value of attribute score.



9
10
11
# File 'lib/passforge/analyzer.rb', line 9

def score
  @score
end

#strengthObject (readonly)

Returns the value of attribute strength.



9
10
11
# File 'lib/passforge/analyzer.rb', line 9

def strength
  @strength
end

#suggestionsObject (readonly)

Returns the value of attribute suggestions.



9
10
11
# File 'lib/passforge/analyzer.rb', line 9

def suggestions
  @suggestions
end

Instance Method Details

#to_hObject



20
21
22
23
24
25
26
27
28
# File 'lib/passforge/analyzer.rb', line 20

def to_h
  {
    score: @score,
    entropy: @entropy.round(2),
    crack_time: @crack_time,
    strength: @strength,
    suggestions: @suggestions
  }
end