Logo
Explore Help
Sign In
discourse/discourse
1
0
Fork 0
You've already forked discourse
mirror of https://github.com/discourse/discourse.git synced 2025-05-30 15:02:19 +00:00
Code Issues Packages Projects Releases Wiki Activity
discourse/lib/age_words.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
231 B
Ruby
Raw Normal View History

DEV: enable frozen string literal on all files This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
2019-05-03 08:17:27 +10:00
# frozen_string_literal: true
Initial release of Discourse
2013-02-05 14:16:51 -05:00
module AgeWords
def self.age_words(secs)
reused value of Time.now in a method `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.
2015-12-01 21:06:37 +00:00
if secs.blank?
"—"
else
now = Time.now
FreedomPatches::Rails4.distance_of_time_in_words(now, now + secs)
end
Initial release of Discourse
2013-02-05 14:16:51 -05:00
end
hacked dates so jeff sees no more 1mons everywhere.
2013-03-13 00:05:21 -07:00
end
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 709ms Template: 5ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API