timeago 0.0.4 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/timeago.rb +25 -11
  2. metadata +4 -4
@@ -6,6 +6,21 @@ class TimeAgo
6
6
  time = Time.new
7
7
  time.strftime("%I:%M:%S %p")
8
8
  end
9
+
10
+ def maximal_time()
11
+
12
+ end
13
+
14
+ def language(lang)
15
+ case lang == "german"
16
+ when "just now" then "gerade jetzt"
17
+ when "#{distance} ago" then "vor #{distance}"
18
+ when "#{distance} from now" then "in #{distance}"
19
+ when "seconds" then "sekunden"
20
+ when "minutes" then "minuten"
21
+ when "hours" then "stunden"
22
+ when "yesterday" then "gestern"
23
+ end
9
24
 
10
25
  def self.readable(time)
11
26
 
@@ -19,14 +34,15 @@ class TimeAgo
19
34
  if rightnow.to_i == backthen.to_i
20
35
  "just now"
21
36
  elsif delta_minutes.abs <= (8724*60)
22
- distance = distance_of_time_in_words(delta_minutes)
23
- if distance <= (8724*60)
24
- return "#{distance} from now"
25
- else
26
- return "#{distance} ago"
27
- end
28
- else
29
- return "on #{DateTime.now.to_formatted_s(date_format)}"
37
+ distance = distance_of_time_in_words(delta_minutes)
38
+ if distance <= (8724*60)
39
+ return "#{distance} from now"
40
+ else
41
+ return "#{distance} ago"
42
+ elsif distance == "yesterday"
43
+ return "yesterday"
44
+ else
45
+ return "on #{DateTime.now.to_formatted_s(date_format)}"
30
46
  end
31
47
  end
32
48
 
@@ -48,10 +64,8 @@ class TimeAgo
48
64
  "one hour"
49
65
  when minutes < 1080
50
66
  "#{(minutes / 60).round} hours"
51
- when minutes < 1440
52
- "one day"
53
67
  when minutes < 2880
54
- "about one day"
68
+ "yesterday"
55
69
  when minutes < 8640
56
70
  "#{(minutes / 1440).round} days"
57
71
  when minutes < 10080
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timeago
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Frederik Reich
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-21 00:00:00 Z
18
+ date: 2012-03-01 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: this gem makes you post times in human readable for, like "one minute ago" instead of the exact time.