mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-05 05:11:30 -05:00
d0955e02d6
`Time.now` was being used to fetch the current time, twice in the same line. This commit stores the time value in a variable and reuses it instead of generating/fetching it for the second time. Additionally, a guard clause in the same method is substituted by an `if/else/end` block for clarity.
12 lines
200 B
Ruby
12 lines
200 B
Ruby
module AgeWords
|
|
|
|
def self.age_words(secs)
|
|
if secs.blank?
|
|
"—"
|
|
else
|
|
now = Time.now
|
|
FreedomPatches::Rails4.distance_of_time_in_words(now, now + secs)
|
|
end
|
|
end
|
|
|
|
end
|