read_time 1.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/read_time.rb +11 -9
- data/lib/read_time/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c5bfe8cf022337cd20d7b7513299b6a035b0408
|
4
|
+
data.tar.gz: 7580568986d02930486395bebcc587f07fb154ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1367f073f9e10a26596935d77ec5404ed4428cf7f8b260c08c3f354b4cbb78a98206fb580f5cb9d355d0b7f0e52751f6b3c36633ada66694db4530266824570c
|
7
|
+
data.tar.gz: 19f43bf717727d7c1c566a51afdb5351d64853977818bb301a336b8c1dced20a0c3390b43c3e1177b795ebf13bbfc2c07c3fe2574e3ed1d7d4aa0ef87a555528
|
data/lib/read_time.rb
CHANGED
@@ -5,23 +5,25 @@ module ReadTime
|
|
5
5
|
@output = ""
|
6
6
|
|
7
7
|
def seconds_to_read
|
8
|
-
(self.split(" ").count
|
8
|
+
(self.split(" ").count/3.3333333333).to_i
|
9
9
|
end
|
10
10
|
|
11
11
|
def minutes_to_read(secs)
|
12
|
-
if secs / 60 >
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
if secs / 60 > 0
|
13
|
+
if secs / 60 > 1
|
14
|
+
@output << "#{secs / 60} minutes "
|
15
|
+
else
|
16
|
+
@output << "1 minute "
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
18
20
|
if secs % 60 > 0
|
19
21
|
if secs % 60 > 1
|
20
22
|
@output << "#{secs % 60} seconds"
|
21
23
|
else
|
22
24
|
@output << "1 second"
|
23
25
|
end
|
24
|
-
end
|
26
|
+
end
|
25
27
|
end
|
26
28
|
|
27
29
|
def hours_to_read(secs)
|
@@ -42,7 +44,7 @@ module ReadTime
|
|
42
44
|
elsif seconds_to_read > 1 && seconds_to_read < 60
|
43
45
|
puts "#{seconds_to_read} seconds"
|
44
46
|
else
|
45
|
-
if seconds_to_read
|
47
|
+
if seconds_to_read >= 3600
|
46
48
|
hours_to_read(seconds_to_read)
|
47
49
|
else
|
48
50
|
minutes_to_read(seconds_to_read)
|
data/lib/read_time/version.rb
CHANGED