work_calendar 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/LICENSE.txt +1 -1
- data/README.md +2 -4
- data/lib/work_calendar/version.rb +1 -1
- data/lib/work_calendar.rb +9 -4
- data/work_calendar-0.1.0.gem +0 -0
- data/work_calendar.gemspec +2 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf7bb9f5e0d3a093260f7300761a6a9a7eeb4044c6619b7b3a9a29522f142635
|
4
|
+
data.tar.gz: 14e439e03311e6213e00f7f18b318303dd3611e183d5d0cbcd92d18fd1d96ded
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5b2fec2157a2fa6cb39a870912356c6acf2451c344dab372ede0c64a9da68aecd0e74fbd96940798d9385a225c6c5f6e41e827df74bb926e4f7ec2417400700
|
7
|
+
data.tar.gz: 40afedcd00e8a2b482ae57562dad7598ceb7b444ee58d24c35de622245c1fb300080381507f20fbab47a30b6908b49daceeb65a3755a2bc2174700ad785f65c2
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
work_calendar (0.1.
|
4
|
+
work_calendar (0.1.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activesupport (6.0.0
|
9
|
+
activesupport (6.0.0)
|
10
10
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
11
11
|
i18n (>= 0.7, < 2)
|
12
12
|
minitest (~> 5.1)
|
13
13
|
tzinfo (~> 1.1)
|
14
|
-
zeitwerk (~> 2.1, >= 2.1.
|
14
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
15
15
|
ast (2.4.0)
|
16
16
|
concurrent-ruby (1.1.5)
|
17
17
|
i18n (1.6.0)
|
@@ -43,12 +43,12 @@ PLATFORMS
|
|
43
43
|
ruby
|
44
44
|
|
45
45
|
DEPENDENCIES
|
46
|
-
activesupport
|
46
|
+
activesupport (~> 6.0)
|
47
47
|
bundler (~> 2.0)
|
48
48
|
minitest (~> 5.0)
|
49
49
|
rake (~> 10.0)
|
50
|
-
rubocop
|
51
|
-
rubocop-performance
|
50
|
+
rubocop (~> 0.71)
|
51
|
+
rubocop-performance (~> 1.3.0)
|
52
52
|
work_calendar!
|
53
53
|
|
54
54
|
BUNDLED WITH
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2019
|
3
|
+
Copyright (c) 2019 Anton Korenyushkin, Sergey Tomashevsky, 2019, Toughbyte LTD
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -32,14 +32,12 @@ Get next `n`'th workday date relative to specified date; if no `date` parameter
|
|
32
32
|
WorkCalendar.next_workday(n, date)
|
33
33
|
```
|
34
34
|
|
35
|
-
|
35
|
+
Get previous workdate relative to specified date; if no `date` parameter was passed, it returns value relative to current day.
|
36
36
|
|
37
37
|
```ruby
|
38
|
-
WorkCalendar.prev_workday(
|
38
|
+
WorkCalendar.prev_workday(date)
|
39
39
|
```
|
40
40
|
|
41
|
-
|
42
|
-
|
43
41
|
## License
|
44
42
|
|
45
43
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/work_calendar.rb
CHANGED
@@ -71,10 +71,9 @@ module WorkCalendar
|
|
71
71
|
date
|
72
72
|
end
|
73
73
|
|
74
|
-
def prev_workday(date = Time.zone.today)
|
75
|
-
|
76
|
-
|
77
|
-
prev_date
|
74
|
+
def prev_workday(num = 1, date = Time.zone.today)
|
75
|
+
num.times { date = _prev_workday(date) }
|
76
|
+
date
|
78
77
|
end
|
79
78
|
|
80
79
|
private
|
@@ -84,5 +83,11 @@ module WorkCalendar
|
|
84
83
|
next_date += 1.day until workday? next_date
|
85
84
|
next_date
|
86
85
|
end
|
86
|
+
|
87
|
+
def _prev_workday(date)
|
88
|
+
prev_date = date - 1.day
|
89
|
+
prev_date -= 1.day until workday? prev_date
|
90
|
+
prev_date
|
91
|
+
end
|
87
92
|
end
|
88
93
|
end
|
Binary file
|
data/work_calendar.gemspec
CHANGED
@@ -7,8 +7,8 @@ require 'work_calendar/version'
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'work_calendar'
|
9
9
|
spec.version = WorkCalendar::VERSION
|
10
|
-
spec.authors = ['Sergey Tomashevsky']
|
11
|
-
spec.email = ['
|
10
|
+
spec.authors = ['Anton Korenyushkin', 'Sergey Tomashevsky']
|
11
|
+
spec.email = ['hello@toughbyte.com']
|
12
12
|
|
13
13
|
spec.summary = 'Workday calculator'
|
14
14
|
spec.description = 'Simple yet effective gem for calculating workday Time objects.'
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: work_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Anton Korenyushkin
|
7
8
|
- Sergey Tomashevsky
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2019-
|
12
|
+
date: 2019-09-06 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activesupport
|
@@ -96,7 +97,7 @@ dependencies:
|
|
96
97
|
version: 1.3.0
|
97
98
|
description: Simple yet effective gem for calculating workday Time objects.
|
98
99
|
email:
|
99
|
-
-
|
100
|
+
- hello@toughbyte.com
|
100
101
|
executables: []
|
101
102
|
extensions: []
|
102
103
|
extra_rdoc_files: []
|
@@ -113,6 +114,7 @@ files:
|
|
113
114
|
- bin/setup
|
114
115
|
- lib/work_calendar.rb
|
115
116
|
- lib/work_calendar/version.rb
|
117
|
+
- work_calendar-0.1.0.gem
|
116
118
|
- work_calendar.gemspec
|
117
119
|
homepage: https://github.com/toughbyte/work_calendar
|
118
120
|
licenses:
|