90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/gh_inspector/evidence.rb', line 90
def to_pretty
a = (Time.now - self).to_i
case a
when 0 then 'just now'
when 1 then 'a second ago'
when 2..59 then a.to_s + ' seconds ago'
when 60..119 then 'a minute ago' when 120..3540 then (a / 60).to_i.to_s + ' minutes ago'
when 3541..7100 then 'an hour ago' when 7101..82_800 then ((a + 99) / 3600).to_i.to_s + ' hours ago'
when 82_801..172_000 then 'a day ago' when 172_001..518_400 then ((a + 800) / (60 * 60 * 24)).to_i.to_s + ' days ago'
when 518_400..1_036_800 then 'a week ago'
when 1_036_801..4_147_204 then ((a + 180_000) / (60 * 60 * 24 * 7)).to_i.to_s + ' weeks ago'
else strftime("%d %b %Y")
end
end
|