attentive 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5103b0c4f607156d2ec0be7d8a85f37b251b9549
4
- data.tar.gz: a75d4626d2ea67fdd580e78710a0b248929baf13
3
+ metadata.gz: 82d538262cfb344744d56a62ab0c55ead35d0513
4
+ data.tar.gz: 2cf0add3bcd0f0a0535d449fc4cd3df181315486
5
5
  SHA512:
6
- metadata.gz: a4c1b0b0c6fe98f5e3eb90dcd5ad8ba43d5e3eece823701b81f13585eccf696304782b19938138d208fbd1c2b6b201a3e02e06f22a6406f8b4e26ae2c5237699
7
- data.tar.gz: 98dc82d2e9411e5bce7c0e7e0d50825fc8cc1afecc95158388ad7dd70a52b7cd8b66599895e434430c69a050c379ee3fdb90b655116d7b4f21fc6ef1f551f02f
6
+ metadata.gz: c4f978dd2eeab193511fc4e19aba9860d5c7407b825a459db411d81bdae24e4692de47aedf9598cda634d774904456d3192f686b4acb67fdf6b333bea965ea9f
7
+ data.tar.gz: d2ea36e5454a21a65c1f75b288fbfc2439a8d892255a8e07d917bc45520d97612ceb428bba4d1d654d81ddb93c31ca17eea1298180d35101e70186e8ffcda909
@@ -22,14 +22,24 @@ module Attentive
22
22
  end
23
23
 
24
24
  def inspect
25
+ "<#{to_s}>"
26
+ end
27
+
28
+ def to_s
25
29
  phrases = []
26
- phrases.push "#{years} years" if years > 0
27
- phrases.push "#{months} months" if months > 0
28
- phrases.push "#{days} days" if days > 0
29
- phrases.push "#{hours} hours" if hours > 0
30
- phrases.push "#{minutes} minutes" if minutes > 0
31
- phrases.push "#{seconds} seconds" if seconds > 0
32
- "<#{phrases.join(" ")}>"
30
+ phrases.push "#{years} #{years > 1 ? "years" : "year"}" if years > 0
31
+ phrases.push "#{months} #{months > 1 ? "months" : "month"}" if months > 0
32
+ phrases.push "#{days} #{days > 1 ? "days" : "day"}" if days > 0
33
+ phrases.push "#{hours} #{hours > 1 ? "hours" : "hour"}" if hours > 0
34
+ phrases.push "#{minutes} #{minutes > 1 ? "minutes" : "minute"}" if minutes > 0
35
+ phrases.push "#{seconds} #{seconds > 1 ? "seconds" : "second"}" if seconds > 0
36
+
37
+ case phrases.length
38
+ when 0 then ""
39
+ when 1 then phrases[0]
40
+ when 2 then phrases.join(" and ")
41
+ else "#{phrases[0...-1].join(", ")}, and #{phrases[-1]}"
42
+ end
33
43
  end
34
44
 
35
45
  def after(date)
@@ -1,3 +1,3 @@
1
1
  module Attentive
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attentive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Lail
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-28 00:00:00.000000000 Z
11
+ date: 2016-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thread_safe