read_time 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18a1ba5b9d00415893677b50180ae7a2d1b3aee3
4
- data.tar.gz: 9fcbc1a2d2365b62a172ed7420822711b3778abe
3
+ metadata.gz: 2c5bfe8cf022337cd20d7b7513299b6a035b0408
4
+ data.tar.gz: 7580568986d02930486395bebcc587f07fb154ea
5
5
  SHA512:
6
- metadata.gz: d8c1c97040059b01b2ce123a3171f797dd6e82775475fa9173f84d87e67e35e5bc172a966d0cefcff3a756dd0bdac62487521a2245ab604602cfd1cc99bdea96
7
- data.tar.gz: b2488ff38d12bf496c35be45d236a4eb95f6c53ffbc1c8cb919a4fe209457c468b04eea108bd00714b94f5d8732ea3517725b1c9f8db4824ffdf72b3f047923f
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 / 3.3333333333).to_i
8
+ (self.split(" ").count/3.3333333333).to_i
9
9
  end
10
10
 
11
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
-
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 > 3600
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)
@@ -1,3 +1,3 @@
1
1
  module ReadTime
2
- VERSION = "1.0.6".freeze
2
+ VERSION = "1.1.0".freeze
3
3
  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.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaan Kölköy