runby_pace 0.6.121 → 0.6.122

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/runby_pace/runby_time.rb +11 -11
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70cde89c41d690b7e35a2e49921cf2f347cfdfd2
4
- data.tar.gz: 7f6695e47150f07c89e664f8f5a360a413639809
3
+ metadata.gz: 77901c6c966192b9bb8b394afedee348ec886fb0
4
+ data.tar.gz: 822b5b11c45e96dbd89b15d2af230453bdef2e4e
5
5
  SHA512:
6
- metadata.gz: efed2ee7348ba9b394821ed1afaa84e35c91746d70be7f773b144251b7e0918679170bd1ec0997e37948b7bec8f44c45bd0ec3fcc240cf17d9e010f873ba803e
7
- data.tar.gz: b3d573405a1d3fe27df705931d5d53d5de36b3350bcb3bd1da04189dd4e1c57cae121cf4f67b6daee3fe7b63955744b68a364066819205e52a7345fcb54b095a
6
+ metadata.gz: 0f22d8c1fec24e77bb5ba33361b22c7903988225e8015f90410e3b76e0909404fc43827bd816f68d9f16f0c24b4c2e3d6bbc93121c4eea56afbe96536b36e935
7
+ data.tar.gz: ee4f606570dee5c43c6f21edecd1de95b524ebe54711a33c1022abbaac70327fccf210505dcf25105d7dfca151e48d29f27b524906827828c9bffc550c3d5223
@@ -97,26 +97,26 @@ module Runby
97
97
  @time_s.sub(/^0/, '')
98
98
  end
99
99
 
100
+ def total_hours
101
+ @hours_part + (@minutes_part / 60.0) + (@seconds_part / 60.0 / 60.0)
102
+ end
103
+
100
104
  def total_seconds
101
- @minutes_part * 60 + @seconds_part
105
+ @hours_part * 60 * 60 + @minutes_part * 60 + @seconds_part
102
106
  end
103
107
 
104
108
  def total_minutes
105
- @minutes_part + (@seconds_part / 60.0)
109
+ @hours_part * 60 + @minutes_part + (@seconds_part / 60.0)
106
110
  end
107
111
 
108
112
  # @param [RunbyTime] other
109
113
  def -(other)
110
- if other.is_a?(RunbyTime)
111
- RunbyTime.from_seconds(total_seconds - other.total_seconds)
112
- end
114
+ RunbyTime.from_seconds(total_seconds - other.total_seconds) if other.is_a?(RunbyTime)
113
115
  end
114
116
 
115
117
  # @param [RunbyTime] other
116
118
  def +(other)
117
- if other.is_a?(RunbyTime)
118
- RunbyTime.from_seconds(total_seconds + other.total_seconds)
119
- end
119
+ RunbyTime.from_seconds(total_seconds + other.total_seconds) if other.is_a?(RunbyTime)
120
120
  end
121
121
 
122
122
  def <=>(other)
@@ -129,9 +129,7 @@ module Runby
129
129
  end
130
130
 
131
131
  def almost_equals?(other_time, tolerance_time = '00:01')
132
- if other_time.is_a?(String)
133
- other_time = RunbyTime.new(other_time)
134
- end
132
+ other_time = RunbyTime.new(other_time) if other_time.is_a?(String)
135
133
  tolerance = RunbyTime.new(tolerance_time)
136
134
  self >= (other_time - tolerance) && self <= (other_time + tolerance)
137
135
  end
@@ -141,6 +139,7 @@ module Runby
141
139
  # @param [Hash] params
142
140
  def init_from_hash(params = {})
143
141
  @time_s = params.fetch :time_s, '00:00'
142
+ @hours_part = params.fetch :hours_part, 0.0
144
143
  @minutes_part = params.fetch :minutes_part, 0.0
145
144
  @seconds_part = params.fetch :seconds_part, 0.0
146
145
  end
@@ -148,6 +147,7 @@ module Runby
148
147
  # @param [RunbyTime] time
149
148
  def init_from_clone(time)
150
149
  @time_s = time.time_s
150
+ @hours_part = time.hours_part
151
151
  @minutes_part = time.minutes_part
152
152
  @seconds_part = time.seconds_part
153
153
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runby_pace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.121
4
+ version: 0.6.122
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ty Walls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-07 00:00:00.000000000 Z
11
+ date: 2017-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,7 +101,7 @@ homepage: https://github.com/tygerbytes/runby-pace
101
101
  licenses:
102
102
  - MIT
103
103
  metadata:
104
- commit-hash: 4387aae31ecca99d9e8887c65f58aef1e877653d
104
+ commit-hash: 6e01e0d8cd177b8143f6042eedabdd453f41b3d6
105
105
  post_install_message:
106
106
  rdoc_options: []
107
107
  require_paths: