From d534e01a723212bccf0f8359332dd298827b79f7 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Sun, 18 Aug 2024 15:06:22 +0300 Subject: [PATCH] #75 doc --- lib/fbe/issue.rb | 2 +- lib/fbe/sec.rb | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/fbe/issue.rb b/lib/fbe/issue.rb index 12d3a3b..3e8d313 100644 --- a/lib/fbe/issue.rb +++ b/lib/fbe/issue.rb @@ -26,7 +26,7 @@ # Converts an ID of GitHub issue into a nicely formatting string. # -# @param [Factbase::Fact] fact The fact, where to get the ID of GitHub user +# @param [Factbase::Fact] fact The fact, where to get the ID of GitHub issue # @param [Judges::Options] options The options coming from the +judges+ tool # @param [Hash] global The hash for global caching # @param [Loog] logg The logging facility diff --git a/lib/fbe/sec.rb b/lib/fbe/sec.rb index afeab75..43df8a7 100644 --- a/lib/fbe/sec.rb +++ b/lib/fbe/sec.rb @@ -24,8 +24,14 @@ require_relative '../fbe' +# Converts number of seconds into text. +# +# @param [Factbase::Fact] fact The fact, where to get the number of seconds +# @param [String] prop The property in the fact, with the seconds def Fbe.sec(fact, prop = :seconds) - s = fact.send(prop.to_s) + s = fact[prop.to_s] + raise "There is no #{prop} property" if s.nil? + s = s.first.to_i if s < 60 format('%d seconds', s) elsif s < 60 * 60