read_time 1.0.0 → 1.0.1

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: 69726aaf213f4ba9056242de62ea85ff1f8d5f9e
4
- data.tar.gz: 6aec382f40168fb222deaa7db3e1478b5082f92f
3
+ metadata.gz: 1298acc849510b25978ba14dcb3b11e9002c8c93
4
+ data.tar.gz: 4dc925d3a4b4071ba4b063e57f35606cf90b6977
5
5
  SHA512:
6
- metadata.gz: 72b4db0b3b7dd6207f1083f69c9f8f291c61825db6146305e2b085bfa68536ecf40e60cb44f76540dcd7b55feb02c0bfdc4ebfca132b1063abcb460f35e398e2
7
- data.tar.gz: f15d938a4d16437e52e9dc0f011f4610ddd833c65ad7c59ea9b1bff0c71a8e1ff17f80a6c1bb8cb66a5ecac74e7bc148bb71ee66a6aaaec19aeb7488f6bd2fa4
6
+ metadata.gz: 4cda20886fe0abf1ea2b0ea45ede2d702d6a5a4ee33d4d0aab699362957d3bfec0ffac71fec8761aa9153e001d97abe32ec9954fdf3795bec8b9b7c97bb3280a
7
+ data.tar.gz: 4a87d17076fe0d4fec5a27f9054358738a49f9d16f6b6ed02d0e19d950b035c9bbe5cd8331e19b4b19eace62d1cfc41b990ef06baa3b88cf2ae2778dee4f9e7f
@@ -1,3 +1,3 @@
1
1
  module ReadTime
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/read_time.rb CHANGED
@@ -1,54 +1,54 @@
1
1
  require "read_time/version"
2
2
 
3
3
  module ReadTime
4
- module String
5
- @@output = ""
6
-
7
- def seconds_to_read
8
- (self.split(" ").count/3.3333333333).to_i
9
- end
10
-
11
- def minutes_to_read(secs)
12
- if secs / 60 > 1
13
- @@output << "#{secs / 60} minutes "
14
- else
15
- @@output << "1 minute "
16
- end
17
-
18
- if secs % 60 > 0
19
- @@output << "#{secs % 60} seconds"
20
- end
21
- end
22
-
23
- def hours_to_read(secs)
24
- if secs / 3600 > 1
25
- @@output << "#{secs / 3600} hours "
26
- else
27
- @@output << "1 hour "
28
- end
29
-
30
- if secs % 3600 > 0
31
- minutes_to_read(secs % 3600)
32
- end
33
- end
34
-
35
- def time_to_read
36
- if seconds_to_read <= 1
37
- puts "1 second"
38
- elsif seconds_to_read > 1 && seconds_to_read < 60
39
- puts "#{seconds_to_read} seconds"
40
- else
41
- if secs > 3600
42
- hours_to_read(seconds_to_read)
43
- else
44
- minutes_to_read(seconds_to_read)
45
- end
46
- puts @@output
47
- end
48
- end
49
- end
4
+ module String
5
+ @@output = ""
6
+
7
+ def seconds_to_read
8
+ (self.split(" ").count/3.3333333333).to_i
9
+ end
10
+
11
+ def minutes_to_read(secs)
12
+ if secs / 60 > 1
13
+ @@output << "#{secs / 60} minutes "
14
+ else
15
+ @@output << "1 minute "
16
+ end
17
+
18
+ if secs % 60 > 0
19
+ @@output << "#{secs % 60} seconds"
20
+ end
21
+ end
22
+
23
+ def hours_to_read(secs)
24
+ if secs / 3600 > 1
25
+ @@output << "#{secs / 3600} hours "
26
+ else
27
+ @@output << "1 hour "
28
+ end
29
+
30
+ if secs % 3600 > 0
31
+ minutes_to_read(secs % 3600)
32
+ end
33
+ end
34
+
35
+ def time_to_read
36
+ if seconds_to_read <= 1
37
+ puts "1 second"
38
+ elsif seconds_to_read > 1 && seconds_to_read < 60
39
+ puts "#{seconds_to_read} seconds"
40
+ else
41
+ if seconds_to_read > 3600
42
+ hours_to_read(seconds_to_read)
43
+ else
44
+ minutes_to_read(seconds_to_read)
45
+ end
46
+ puts @@output
47
+ end
48
+ end
49
+ end
50
50
  end
51
51
 
52
52
  class String
53
- include ReadTime::String
53
+ include ReadTime::String
54
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: read_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaan Kölköy