You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
702 B
31 lines
702 B
module CryptCheck
|
|
module Tls
|
|
module Grade
|
|
include CryptCheck::Grade
|
|
|
|
private
|
|
|
|
def calculate_grade
|
|
return :V unless self.valid?
|
|
return :T unless self.trusted?
|
|
|
|
states = self.states
|
|
states = State.collect { |s| [s, State.state(states, s)] }.to_h
|
|
|
|
State::BADS.each do |s|
|
|
return STATUS_GRADES[s] if states[s]
|
|
end
|
|
|
|
grade = STATUS_GRADES[:default]
|
|
State::GOODS.each do |s|
|
|
state = states[s]
|
|
return grade if state == false
|
|
grade = STATUS_GRADES[s]
|
|
return grade if state == :some
|
|
grade = "#{grade}+".to_sym
|
|
end
|
|
grade
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|