lib/alex_codebreaker/session.rb in alex_codebreaker-0.1.11 vs lib/alex_codebreaker/session.rb in alex_codebreaker-0.1.12
- old
+ new
@@ -30,10 +30,13 @@
def check_hints
@hints_used += 1 if @hints_used < @hints_total
end
def check_attempts
- @attempts_used += 1 if @attempts_used < @attempts_total - 1
+ @attempts_used += 1
+ return unless @attempts_used < @attempts_total
+
+ @attempts_used
end
def save_statistic
@time = Time.new
File.open(AlexCodebreaker.configuration.storage_path, 'a') { |file| file.write(to_yaml) }