punch_time 0.1.3 → 0.1.6
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/.gitignore +2 -1
- data/CHANGELOG.md +10 -0
- data/README.md +40 -11
- data/bin/console +1 -1
- data/lib/punch_time/time_record.rb +1 -0
- data/lib/punch_time/version.rb +1 -1
- data/punch_time.gemspec +6 -5
- metadata +28 -15
- data/Gemfile.lock +0 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bba49e33ef9ed12b8fae81b3356d9f6628fa3484d0b4e5a154ec48a531b2a33
|
4
|
+
data.tar.gz: 2d9cb26844479f93a6d785012df6039a17dfd47691f28aa5f094d3e4f53fd4b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a3a68ec6c6de05c372740731363d207077df6a5b6d8dc0754d61e31d3888e4b1d1b11128b939e51dfc8bc374a56cdfb8ffd7f524a2515fb0a5990bdedeedaea
|
7
|
+
data.tar.gz: 84ef1e81b1bd152ef74e9569d029b9a33604295e95423b182ec7b11f6c8e12a11f688087ff8d43afbb525c7539412dcfe56ac8367cd10742e8bc81909b185c26
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
# punch_time
|
2
2
|
|
3
|
-
|
3
|
+

|
4
|
+
[](https://badge.fury.io/rb/punch_time)
|
5
|
+

|
6
|
+
[](https://github.com/rubocop-hq/rubocop)
|
7
|
+
[](https://circleci.com/bb/smapira/punch_time)
|
4
8
|
|
9
|
+
Work time calculations using punch clock.
|
5
10
|
|
6
|
-
|
11
|
+
## See It Work
|
7
12
|
|
8
|
-
|
13
|
+
[](https://asciinema.org/a/489536)
|
9
14
|
|
10
15
|
## Features
|
11
16
|
|
@@ -13,8 +18,8 @@ Calculates a work, a tardy, a overtime work and a night work times.
|
|
13
18
|
|
14
19
|
## Motivation
|
15
20
|
|
16
|
-
Proud to present our newest line of gem, the
|
17
|
-
If you would kindly accept
|
21
|
+
Proud to present our newest line of gem, the back office calculations series. As you know, the modern human resource calculations has been needing a large variety of case. This gem include simplest calculator for overtime work, night work and tardy time.
|
22
|
+
If you would kindly accept the deliverable, this gem willing to calculation.
|
18
23
|
|
19
24
|
## Installation
|
20
25
|
|
@@ -49,7 +54,7 @@ config.night = {
|
|
49
54
|
start_time: Time.parse('22:00'),
|
50
55
|
end_time: Time.parse('05:00')
|
51
56
|
}
|
52
|
-
|
57
|
+
config.offset = '+0000'
|
53
58
|
end
|
54
59
|
```
|
55
60
|
|
@@ -59,16 +64,24 @@ end
|
|
59
64
|
# Set the your time record
|
60
65
|
PunchTime.punch(DateTime.parse('20200101 10:10'), DateTime.parse('20200101 19:00'))
|
61
66
|
|
62
|
-
# Calculations can be performed in
|
67
|
+
# Calculations can be performed in minutes, hours, or days
|
63
68
|
p PunchTime.sum_work.hours
|
69
|
+
# => 8
|
70
|
+
|
71
|
+
p PunchTime.sum_work.minutes
|
72
|
+
# => 480
|
64
73
|
|
65
74
|
# When need calculate holiday work time (use with business_time)
|
75
|
+
|
76
|
+
require 'business_time'
|
77
|
+
|
66
78
|
sum_works = []
|
67
79
|
Date.parse('20200101').upto(Date.parse('20200105')) do |x|
|
68
80
|
PunchTime.punch(DateTime.parse(x.to_s + ' 10:10'), DateTime.parse(x.to_s + ' 19:00'))
|
69
81
|
sum_works.append(PunchTime.sum_work.hours) unless x.workday?
|
70
82
|
end
|
71
|
-
p sum_works.inject(:+)
|
83
|
+
p sum_works.inject(:+).to_i
|
84
|
+
# => 16
|
72
85
|
|
73
86
|
# Other methods
|
74
87
|
PunchTime.sum_work
|
@@ -82,17 +95,33 @@ PunchTime.night_overtime_work?
|
|
82
95
|
|
83
96
|
## Contributing
|
84
97
|
|
85
|
-
Bug reports and pull requests are welcome on GitHub at https://bitbucket.org/
|
98
|
+
Bug reports and pull requests are welcome on GitHub at https://bitbucket.org/smapira/punch_time. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
86
99
|
|
87
100
|
## License
|
88
101
|
|
89
102
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
90
103
|
|
104
|
+
## Changelog
|
105
|
+
|
106
|
+
punch_time's changelog is available [here](https://bitbucket.org/smapira/punch_time/blob/master/CHANGELOG.md.md).
|
107
|
+
|
91
108
|
## Code of Conduct
|
92
109
|
|
93
|
-
Everyone interacting in the PunchClock project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://bitbucket.org/
|
110
|
+
Everyone interacting in the PunchClock project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://bitbucket.org/smapira/punch_time/blob/master/CODE_OF_CONDUCT.md).
|
111
|
+
|
112
|
+
## You may enjoy owning other libraries and my company.
|
113
|
+
|
114
|
+
* [routeflagsinc / jma — Bitbucket](https://bitbucket.org/routeflagsinc/jma/src/main/)
|
115
|
+
- for the Japan Meteorological Agency (気象庁) for searching new information simplifies.
|
116
|
+
* [smapira / punch_time — Bitbucket](https://bitbucket.org/smapira/punch_time/src/master/)
|
117
|
+
- Work time calculations using punch clock.
|
118
|
+
* [smapira / rspec-css — Bitbucket](https://bitbucket.org/smapira/rspec-css/src/master/)
|
119
|
+
- Record your test suite's computed CSS during future test runs for deterministic and accurate tests.
|
120
|
+
* [routeflags/timeline_rails_helper: The TimelineRailsHelper provides a timeline_molecules_tag helper to draw a vertical time line usable with vanilla CSS.](https://github.com/routeflags/timeline_rails_helper)
|
121
|
+
* [routeflags/acts_as_tree_diagram: ActsAsTreeDiagram extends ActsAsTree to add simple function for draw tree diagram with html.](https://github.com/routeflags/acts_as_tree_diagram)
|
122
|
+
* [株式会社旗指物](https://blog.routeflags.com/)
|
94
123
|
|
95
|
-
##
|
124
|
+
## Аcknowledgments
|
96
125
|
|
97
126
|
- [biz](https://github.com/zendesk/biz)
|
98
127
|
- [business_time](https://github.com/bokmann/business_time)
|
data/bin/console
CHANGED
data/lib/punch_time/version.rb
CHANGED
data/punch_time.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
|
13
13
|
spec.summary = 'Work time calculations using punch clock.'
|
14
14
|
spec.description = 'Work time calculations using punch clock.'
|
15
|
-
spec.homepage = 'https://bitbucket.org/
|
15
|
+
spec.homepage = 'https://bitbucket.org/smapira/punch_time'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
18
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
if spec.respond_to?(:metadata)
|
21
21
|
|
22
22
|
spec.metadata['homepage_uri'] = spec.homepage
|
23
|
-
spec.metadata['source_code_uri'] = 'https://bitbucket.org/
|
24
|
-
spec.metadata['changelog_uri'] = 'https://bitbucket.org/
|
23
|
+
spec.metadata['source_code_uri'] = 'https://bitbucket.org/smapira/punch_time'
|
24
|
+
spec.metadata['changelog_uri'] = 'https://bitbucket.org/smapira/punch_time/blob/master/CHANGELOG.md'
|
25
25
|
else
|
26
26
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
27
27
|
'public gem pushes.'
|
@@ -39,7 +39,8 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_dependency 'activemodel'
|
40
40
|
spec.add_dependency 'activesupport'
|
41
41
|
spec.add_development_dependency 'bundler'
|
42
|
-
spec.add_development_dependency '
|
43
|
-
spec.add_development_dependency '
|
42
|
+
spec.add_development_dependency 'business_time'
|
43
|
+
spec.add_development_dependency 'rake'
|
44
|
+
spec.add_development_dependency 'rspec'
|
44
45
|
spec.add_development_dependency 'rubocop'
|
45
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: punch_time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- smapira
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -52,34 +52,48 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: business_time
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rubocop
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +123,6 @@ files:
|
|
109
123
|
- CHANGELOG.md
|
110
124
|
- CODE_OF_CONDUCT.md
|
111
125
|
- Gemfile
|
112
|
-
- Gemfile.lock
|
113
126
|
- LICENSE.txt
|
114
127
|
- README.md
|
115
128
|
- Rakefile
|
@@ -122,13 +135,13 @@ files:
|
|
122
135
|
- lib/punch_time/version.rb
|
123
136
|
- punch_time.gemspec
|
124
137
|
- support/body_punch_hand.png
|
125
|
-
homepage: https://bitbucket.org/
|
138
|
+
homepage: https://bitbucket.org/smapira/punch_time
|
126
139
|
licenses:
|
127
140
|
- MIT
|
128
141
|
metadata:
|
129
|
-
homepage_uri: https://bitbucket.org/
|
130
|
-
source_code_uri: https://bitbucket.org/
|
131
|
-
changelog_uri: https://bitbucket.org/
|
142
|
+
homepage_uri: https://bitbucket.org/smapira/punch_time
|
143
|
+
source_code_uri: https://bitbucket.org/smapira/punch_time
|
144
|
+
changelog_uri: https://bitbucket.org/smapira/punch_time/blob/master/CHANGELOG.md
|
132
145
|
post_install_message:
|
133
146
|
rdoc_options: []
|
134
147
|
require_paths:
|
data/Gemfile.lock
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
punch_time (0.1.3)
|
5
|
-
activemodel
|
6
|
-
activesupport
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
activemodel (6.0.2.1)
|
12
|
-
activesupport (= 6.0.2.1)
|
13
|
-
activesupport (6.0.2.1)
|
14
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
-
i18n (>= 0.7, < 2)
|
16
|
-
minitest (~> 5.1)
|
17
|
-
tzinfo (~> 1.1)
|
18
|
-
zeitwerk (~> 2.2)
|
19
|
-
ast (2.4.0)
|
20
|
-
concurrent-ruby (1.1.5)
|
21
|
-
diff-lcs (1.3)
|
22
|
-
i18n (1.8.2)
|
23
|
-
concurrent-ruby (~> 1.0)
|
24
|
-
jaro_winkler (1.5.4)
|
25
|
-
minitest (5.14.0)
|
26
|
-
parallel (1.19.1)
|
27
|
-
parser (2.7.0.2)
|
28
|
-
ast (~> 2.4.0)
|
29
|
-
rainbow (3.0.0)
|
30
|
-
rake (10.5.0)
|
31
|
-
rspec (3.9.0)
|
32
|
-
rspec-core (~> 3.9.0)
|
33
|
-
rspec-expectations (~> 3.9.0)
|
34
|
-
rspec-mocks (~> 3.9.0)
|
35
|
-
rspec-core (3.9.1)
|
36
|
-
rspec-support (~> 3.9.1)
|
37
|
-
rspec-expectations (3.9.0)
|
38
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.9.0)
|
40
|
-
rspec-mocks (3.9.1)
|
41
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.9.0)
|
43
|
-
rspec-support (3.9.2)
|
44
|
-
rubocop (0.79.0)
|
45
|
-
jaro_winkler (~> 1.5.1)
|
46
|
-
parallel (~> 1.10)
|
47
|
-
parser (>= 2.7.0.1)
|
48
|
-
rainbow (>= 2.2.2, < 4.0)
|
49
|
-
ruby-progressbar (~> 1.7)
|
50
|
-
unicode-display_width (>= 1.4.0, < 1.7)
|
51
|
-
ruby-progressbar (1.10.1)
|
52
|
-
thread_safe (0.3.6)
|
53
|
-
tzinfo (1.2.6)
|
54
|
-
thread_safe (~> 0.1)
|
55
|
-
unicode-display_width (1.6.1)
|
56
|
-
zeitwerk (2.2.2)
|
57
|
-
|
58
|
-
PLATFORMS
|
59
|
-
ruby
|
60
|
-
|
61
|
-
DEPENDENCIES
|
62
|
-
bundler
|
63
|
-
punch_time!
|
64
|
-
rake (~> 10.0)
|
65
|
-
rspec (~> 3.0)
|
66
|
-
rubocop
|
67
|
-
|
68
|
-
BUNDLED WITH
|
69
|
-
2.1.4
|