timesplit 0.1.0 → 0.1.1

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
- SHA1:
3
- metadata.gz: 1fab7486909ad6c8b926930eb3bedec0be07d137
4
- data.tar.gz: 28f98ef7031a372b97363813b8eabf5fc7abc288
2
+ SHA256:
3
+ metadata.gz: 59337d9c0b3566ea1da9f453c22c13a6c6707f8b6208e6cbf802d29053836268
4
+ data.tar.gz: 82798c601f9846abc4ec7e45f7a82d842257a99ed8432b5de336fca08e4ca6cd
5
5
  SHA512:
6
- metadata.gz: eb85869688f2802293e779f306f9d255569313e97f5742063ec9b93066c7fe0591ce17997b1b5ff3db36d563cad700c0b938e41be9fb42eee381167279fa27ed
7
- data.tar.gz: 98a558bccc9bfa01667588aaa8b319a5db386b9fb48a1d73e1c5f805ac8a261d20550a75cb5e989af82411d61dbe05a43460d3e9b8257f928f0f17d9674880cc
6
+ metadata.gz: da01fd5e23d869932d262332057290d4793a5ecffcb410ef8983c79ada7e2df715accf5a974fdf672d5993428917a411787820ba0297bb6a4c624f18a851ba5b
7
+ data.tar.gz: a78864a3a657363c1b5384c651a41b111041ed7bbfab3d2652a784cf71e43037b5dd05a616d1a90b7ac31e0582ce0eb437f9149d4381fd1e5d458cae2c955cbc
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ .coveralls.yml
@@ -0,0 +1 @@
1
+ timesplit
@@ -0,0 +1 @@
1
+ ruby-2.5.0
@@ -3,3 +3,5 @@ language: ruby
3
3
  rvm:
4
4
  - 2.4.0
5
5
  before_install: gem install bundler -v 1.15.3
6
+ script:
7
+ - rake
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # Timesplit
1
+ # Timesplit 🏃🏻
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/timesplit.svg)](https://badge.fury.io/rb/timesplit)
4
+ [![Coverage Status](https://coveralls.io/repos/github/SleepingInsomniac/timesplit/badge.svg?branch=master)](https://coveralls.io/github/SleepingInsomniac/timesplit?branch=master)
5
+ [![Download Count](http://ruby-gem-downloads-badge.herokuapp.com/timesplit)](http://ruby-gem-downloads-badge.herokuapp.com/timesplit)
2
6
 
3
7
  ```ruby
4
8
  Split(4,0).to_s # => '00:04:00'
@@ -1,14 +1,14 @@
1
1
  module Timesplit
2
2
  class Split
3
3
 
4
- SECS = 60
4
+ SECS = 60.0
5
5
 
6
6
  def self.[](*values)
7
7
  new(*values)
8
8
  end
9
9
 
10
10
  def initialize(*times)
11
- times = times.first.split(/[^\d]+/).map(&:to_i) if times.first.is_a? String
11
+ times = times.first.split(/[^\d]+/).map(&:to_f) if times.first.is_a? String
12
12
  multiplier = 1
13
13
  @seconds = times.reverse.reduce do |t, n|
14
14
  t += n * (multiplier *= SECS)
@@ -29,38 +29,42 @@ module Timesplit
29
29
 
30
30
  def to_s
31
31
  [
32
- hours.to_s.rjust(2, '0'),
33
- minutes.to_s.rjust(2, '0'),
34
- seconds.to_s.rjust(2, '0'),
32
+ hours.to_i.to_s.rjust(2, '0'),
33
+ minutes.to_i.to_s.rjust(2, '0'),
34
+ seconds.to_i.to_s.rjust(2, '0'),
35
35
  ].join(':')
36
36
  end
37
37
 
38
38
  def to_i
39
- @seconds
39
+ @seconds.to_i
40
+ end
41
+
42
+ def to_f
43
+ @seconds.to_f
40
44
  end
41
45
 
42
46
  def ==(other)
43
- self.to_i == other.to_i
47
+ self.to_f == other.to_f
44
48
  end
45
49
 
46
50
  def coerce(other)
47
- [Split.new(other.to_i), self]
51
+ [Split.new(other.to_f), self]
48
52
  end
49
53
 
50
54
  def +(other)
51
- Split.new(@seconds + other.to_i)
55
+ Split.new(@seconds + other.to_f)
52
56
  end
53
57
 
54
58
  def -(other)
55
- Split.new(@seconds - other.to_i)
59
+ Split.new(@seconds - other.to_f)
56
60
  end
57
61
 
58
62
  def /(other)
59
- Split.new(@seconds / other.to_i)
63
+ Split.new(@seconds / other.to_f)
60
64
  end
61
65
 
62
66
  def *(other)
63
- Split.new(@seconds * other.to_i)
67
+ Split.new(@seconds * other.to_f)
64
68
  end
65
69
 
66
70
  private
@@ -1,3 +1,3 @@
1
1
  module Timesplit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
  spec.add_development_dependency 'guard-rspec'
30
- spec.add_development_dependency 'simplecov'
30
+ spec.add_development_dependency 'coveralls'
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timesplit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Clink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-30 00:00:00.000000000 Z
11
+ date: 2018-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: simplecov
70
+ name: coveralls
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -92,6 +92,8 @@ extra_rdoc_files: []
92
92
  files:
93
93
  - ".gitignore"
94
94
  - ".rspec"
95
+ - ".ruby-gemset"
96
+ - ".ruby-version"
95
97
  - ".travis.yml"
96
98
  - Gemfile
97
99
  - Guardfile
@@ -124,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
126
  version: '0'
125
127
  requirements: []
126
128
  rubyforge_project:
127
- rubygems_version: 2.6.12
129
+ rubygems_version: 2.7.4
128
130
  signing_key:
129
131
  specification_version: 4
130
132
  summary: Time split calculator!