one_inch_punch 0.6.1 → 0.6.3
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 +4 -4
- data/History.txt +10 -0
- data/lib/punch/core_ext.rb +1 -1
- data/lib/punch/core_ext/{fixnum.rb → integer.rb} +3 -3
- data/lib/punch/version.rb +1 -1
- data/spec/{fixnum_spec.rb → integer_spec.rb} +6 -6
- data/spec/punch_instance_spec.rb +3 -3
- data/spec/punch_spec.rb +8 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d716a3d8e97f70edd2a39cab9b7debf380e9ecfb
|
4
|
+
data.tar.gz: 149ec221fcf870c17cf8dbcd5a385ade97eacd69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdcc524dcd523ff1b2abab03c32e0d3d150bcdb129a687ff53d1939b727a3678efd0a774b3fe16814e0cb23332b9dc346ad527dfc13ab08b66a54fc31a77c5ef
|
7
|
+
data.tar.gz: 7e7a0dd62125f956cd065b195777cc90d7f9379cbcc2492f0cecf2ee44dc3d7b9b58632ac6abeae34d1917e3646193123c48c05f3caea854201e45fc1b5fa8b7
|
data/History.txt
CHANGED
data/lib/punch/core_ext.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'punch/core_ext/
|
1
|
+
require 'punch/core_ext/integer'
|
@@ -1,11 +1,11 @@
|
|
1
|
-
class
|
1
|
+
class Integer
|
2
2
|
def elapsed_time
|
3
3
|
minutes, seconds = divmod(60)
|
4
4
|
hours, minutes = minutes.divmod(60)
|
5
|
-
|
5
|
+
|
6
6
|
seconds = '%02d' % seconds
|
7
7
|
minutes = '%02d' % minutes
|
8
|
-
|
8
|
+
|
9
9
|
time = "#{minutes}:#{seconds}"
|
10
10
|
time = "#{hours}:#{time}" unless hours.zero?
|
11
11
|
time
|
data/lib/punch/version.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper.rb')
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Integer do
|
4
4
|
it 'should give an elapsed time' do
|
5
5
|
50.should.respond_to(:elapsed_time)
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
describe 'giving an elapsed time' do
|
9
9
|
it 'should convert the number as seconds to an HH:MM:SS format' do
|
10
10
|
60174.elapsed_time.should == '16:42:54'
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it 'should format seconds as two digits' do
|
14
14
|
135182.elapsed_time.should == '37:33:02'
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it 'should format minutes as two digits' do
|
18
18
|
39900.elapsed_time.should == '11:05:00'
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it 'should not format hours as two digits' do
|
22
22
|
3900.elapsed_time.should == '1:05:00'
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it 'should not includes hours if the time is less than an hour' do
|
26
26
|
890.elapsed_time.should == '14:50'
|
27
27
|
end
|
data/spec/punch_instance_spec.rb
CHANGED
@@ -559,9 +559,9 @@ describe Punch, 'instance' do
|
|
559
559
|
end
|
560
560
|
|
561
561
|
@projects = {}
|
562
|
-
@projects['parent'] = '
|
563
|
-
@projects['child'] = @projects['parent'] + '/
|
564
|
-
@projects['kid'] = @projects['parent'] + '/
|
562
|
+
@projects['parent'] = 'part'
|
563
|
+
@projects['child'] = @projects['parent'] + '/kid'
|
564
|
+
@projects['kid'] = @projects['parent'] + '/other'
|
565
565
|
|
566
566
|
@data = { @projects['parent'] => [], @projects['child'] => [], @projects['kid'] => [] }
|
567
567
|
Punch.data = @data
|
data/spec/punch_spec.rb
CHANGED
@@ -393,8 +393,8 @@ describe Punch do
|
|
393
393
|
|
394
394
|
describe 'handling a sub-project' do
|
395
395
|
before do
|
396
|
-
@projects['parent'] = '
|
397
|
-
@projects['child'] = @projects['parent'] + '/
|
396
|
+
@projects['parent'] = 'part'
|
397
|
+
@projects['child'] = @projects['parent'] + '/kid'
|
398
398
|
end
|
399
399
|
|
400
400
|
it "should return 'in' for a non-existent parent project if the sub-project is punched in" do
|
@@ -944,8 +944,8 @@ describe Punch do
|
|
944
944
|
describe 'handling a sub-project' do
|
945
945
|
before do
|
946
946
|
@projects = {}
|
947
|
-
@projects['parent'] = '
|
948
|
-
@projects['child'] = @projects['parent'] + '/
|
947
|
+
@projects['parent'] = 'part'
|
948
|
+
@projects['child'] = @projects['parent'] + '/kid'
|
949
949
|
end
|
950
950
|
|
951
951
|
it 'should actually punch out the sub-project when told to punch out the parent project' do
|
@@ -1269,8 +1269,8 @@ describe Punch do
|
|
1269
1269
|
describe 'handling a sub-project' do
|
1270
1270
|
before do
|
1271
1271
|
@projects = {}
|
1272
|
-
@projects['parent'] = '
|
1273
|
-
@projects['child'] = @projects['parent'] + '/
|
1272
|
+
@projects['parent'] = 'part'
|
1273
|
+
@projects['child'] = @projects['parent'] + '/kid'
|
1274
1274
|
@data[@projects['parent']] = [ { 'in' => @now - 100, 'out' => @now - 50 } ]
|
1275
1275
|
@data[@projects['child']] = [ { 'in' => @now - 20 } ]
|
1276
1276
|
Punch.data = @data
|
@@ -1466,8 +1466,8 @@ describe Punch do
|
|
1466
1466
|
describe 'handling a sub-project' do
|
1467
1467
|
before do
|
1468
1468
|
@projects = {}
|
1469
|
-
@projects['parent'] = '
|
1470
|
-
@projects['child'] = @projects['parent'] + '/
|
1469
|
+
@projects['parent'] = 'part'
|
1470
|
+
@projects['child'] = @projects['parent'] + '/kid'
|
1471
1471
|
@data[@projects['parent']] = [ { 'in' => @now - 100, 'out' => @now - 50 } ]
|
1472
1472
|
@data[@projects['child']] = [ { 'in' => @now - 20, 'out' => @now - 10 } ]
|
1473
1473
|
Punch.data = @data
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: one_inch_punch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yossef Mendelssohn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bacon
|
@@ -52,10 +52,10 @@ files:
|
|
52
52
|
- bin/punch
|
53
53
|
- lib/punch.rb
|
54
54
|
- lib/punch/core_ext.rb
|
55
|
-
- lib/punch/core_ext/
|
55
|
+
- lib/punch/core_ext/integer.rb
|
56
56
|
- lib/punch/instance.rb
|
57
57
|
- lib/punch/version.rb
|
58
|
-
- spec/
|
58
|
+
- spec/integer_spec.rb
|
59
59
|
- spec/punch_command_spec.rb
|
60
60
|
- spec/punch_instance_spec.rb
|
61
61
|
- spec/punch_spec.rb
|