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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 378bfd0ca8bb7a6e03456e9514a1a3e1cb4e44ffe3735b95ac4d35321d8e0c96
4
- data.tar.gz: d9242ab9ebe24d3a75423ec02518c8ba8b568b7799aad0b8205ec1ba651c9480
3
+ metadata.gz: 2bba49e33ef9ed12b8fae81b3356d9f6628fa3484d0b4e5a154ec48a531b2a33
4
+ data.tar.gz: 2d9cb26844479f93a6d785012df6039a17dfd47691f28aa5f094d3e4f53fd4b4
5
5
  SHA512:
6
- metadata.gz: 4d0bae899922bb247d3a368cff7cd311931d4077ca4374ccc31746f3eb1be308ce3a85404a57349b6e1e17df1249cb9012a51c3d0d5589877f90815bea3f3568
7
- data.tar.gz: f47e1b59a67c5f47e661b4def268e3ea613c18fb89f09f79ba30662ce137e506b3a8bde23577764453e13eae7cf5937044138849475ce74a189b295425a25fca
6
+ metadata.gz: 2a3a68ec6c6de05c372740731363d207077df6a5b6d8dc0754d61e31d3888e4b1d1b11128b939e51dfc8bc374a56cdfb8ffd7f524a2515fb0a5990bdedeedaea
7
+ data.tar.gz: 84ef1e81b1bd152ef74e9569d029b9a33604295e95423b182ec7b11f6c8e12a11f688087ff8d43afbb525c7539412dcfe56ac8367cd10742e8bc81909b185c26
data/.gitignore CHANGED
@@ -11,4 +11,5 @@
11
11
  .rspec_status
12
12
  .idea
13
13
  vendor
14
- .rspec_status
14
+ .rspec_status
15
+ Gemfile.lock
data/CHANGELOG.md CHANGED
@@ -0,0 +1,10 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2020-02-11
4
+
5
+ - Initial release
6
+
7
+ ## [0.1.6] - 2022-04-23
8
+
9
+ - Revise documents
10
+
data/README.md CHANGED
@@ -1,11 +1,16 @@
1
1
  # punch_time
2
2
 
3
- [![CircleCI](https://circleci.com/bb/routeflagsinc/punch_time.svg?style=svg)](https://circleci.com/bb/routeflagsinc/punch_time)
3
+ ![Ruby](https://img.shields.io/badge/Ruby-CC342D?style=for-the-badge&logo=ruby&logoColor=white)
4
+ [![Gem Version](https://badge.fury.io/rb/punch_time.svg)](https://badge.fury.io/rb/punch_time)
5
+ ![](https://ruby-gem-downloads-badge.herokuapp.com/punch_time)
6
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
7
+ [![CircleCI](https://circleci.com/bb/smapira/punch_time.svg?style=svg)](https://circleci.com/bb/smapira/punch_time)
4
8
 
9
+ Work time calculations using punch clock.
5
10
 
6
- [logo]: https://bitbucket.org/routeflagsinc/punch_time/raw/c0df4f773da9bd66822186350f6516efe3be5a72/support/body_punch_hand.png "punch"
11
+ ## See It Work
7
12
 
8
- Work time calculations using punch clock.
13
+ [![asciicast](https://asciinema.org/a/489536.svg)](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 human resource 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.
17
- If you would kindly accept our request, this gem willing to calculation.
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
- config.offset = '+0000'
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 seconds, minutes, hours, or days
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/routeflagsinc/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.
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/routeflagsinc/punch_time/blob/master/CODE_OF_CONDUCT.md).
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
- ## Good stuffs
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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "punch/clock"
4
+ require "punch_time"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -143,6 +143,7 @@ module PunchTime
143
143
  # @return [Struct]
144
144
  def convert_humanize(value)
145
145
  value ||= Rational(0)
146
+ value = Rational(0) if value.negative?
146
147
  Scale.new(value,
147
148
  value.to_i,
148
149
  (value * DAY_HOURS).to_i,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PunchTime
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.6'
5
5
  end
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/routeflagsinc/punch_time'
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/routeflagsinc/punch_time'
24
- spec.metadata['changelog_uri'] = 'https://bitbucket.org/routeflagsinc/punch_time/blob/master/CHANGELOG.md'
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 'rake', '~> 10.0'
43
- spec.add_development_dependency 'rspec', '~> 3.0'
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.3
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: 2020-02-10 00:00:00.000000000 Z
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: '10.0'
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: '10.0'
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: '3.0'
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: '3.0'
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/routeflagsinc/punch_time
138
+ homepage: https://bitbucket.org/smapira/punch_time
126
139
  licenses:
127
140
  - MIT
128
141
  metadata:
129
- homepage_uri: https://bitbucket.org/routeflagsinc/punch_time
130
- source_code_uri: https://bitbucket.org/routeflagsinc/punch_time
131
- changelog_uri: https://bitbucket.org/routeflagsinc/punch_time/blob/master/CHANGELOG.md
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