work_calendar 0.1.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf7bb9f5e0d3a093260f7300761a6a9a7eeb4044c6619b7b3a9a29522f142635
4
- data.tar.gz: 14e439e03311e6213e00f7f18b318303dd3611e183d5d0cbcd92d18fd1d96ded
3
+ metadata.gz: f66433c0f4ff9e22ecbc54a74a4c329ba40649a72e4a1cfeeeb643c92f606f28
4
+ data.tar.gz: 3ec2123e14ac3f60b18738546c2630e1c1c9f2154397d99826902d0a80e548e6
5
5
  SHA512:
6
- metadata.gz: b5b2fec2157a2fa6cb39a870912356c6acf2451c344dab372ede0c64a9da68aecd0e74fbd96940798d9385a225c6c5f6e41e827df74bb926e4f7ec2417400700
7
- data.tar.gz: 40afedcd00e8a2b482ae57562dad7598ceb7b444ee58d24c35de622245c1fb300080381507f20fbab47a30b6908b49daceeb65a3755a2bc2174700ad785f65c2
6
+ metadata.gz: 668d6439db8f984c36352908e5c2b030ca298eb3af6c94f772baf9d0f91fa3b1dd6db17fc73f94950e0376e4ea47100ee1fabcb42900c2069e0e0d93d619a386
7
+ data.tar.gz: 9a555ad38e58beb479b1907360e62aeda71fc005f168c2747802406f39b7580ad98717745c93d867b8798823a28baf7827a05788a39cddcb61d6018d45ed27b3
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /work_calendar-*.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- work_calendar (0.1.1)
4
+ work_calendar (1.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -52,4 +52,4 @@ DEPENDENCIES
52
52
  work_calendar!
53
53
 
54
54
  BUNDLED WITH
55
- 2.0.2
55
+ 2.2.22
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Anton Korenyushkin, Sergey Tomashevsky, 2019, Toughbyte LTD
3
+ Copyright (c) 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,10 +32,17 @@ 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
- Get previous workdate relative to specified date; if no `date` parameter was passed, it returns value relative to current day.
35
+ Works same way as `next_workday` method, only looking backwards.
36
36
 
37
37
  ```ruby
38
- WorkCalendar.prev_workday(date)
38
+ WorkCalendar.prev_workday(n, date)
39
+ ```
40
+
41
+ Get first/last day since specified date
42
+
43
+ ```ruby
44
+ WorkCalendar.first_workday_since(date)
45
+ WorkCalendar.last_workday_since(date)
39
46
  ```
40
47
 
41
48
  ## License
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkCalendar
4
- VERSION = '0.1.1'
4
+ VERSION = '1.0.3'
5
5
  end
data/lib/work_calendar.rb CHANGED
@@ -47,6 +47,51 @@ module WorkCalendar
47
47
  11 => {
48
48
  holidays: [4]
49
49
  }
50
+ },
51
+ 2021 => {
52
+ 1 => {
53
+ holidays: [1, 4, 5, 6, 7, 8]
54
+ },
55
+ 2 => {
56
+ workdays: [20],
57
+ holidays: [22, 23]
58
+ },
59
+ 3 => {
60
+ holidays: [8]
61
+ },
62
+ 5 => {
63
+ holidays: [3, 10]
64
+ },
65
+ 6 => {
66
+ holidays: [14]
67
+ },
68
+ 11 => {
69
+ holidays: [4, 5]
70
+ },
71
+ 12 => {
72
+ holidays: [31]
73
+ }
74
+ },
75
+ 2022 => {
76
+ 1 => {
77
+ holidays: [3, 4, 5, 6, 7]
78
+ },
79
+ 2 => {
80
+ holidays: [23]
81
+ },
82
+ 3 => {
83
+ workdays: [5],
84
+ holidays: [7, 8]
85
+ },
86
+ 5 => {
87
+ holidays: [2, 3, 9, 10]
88
+ },
89
+ 6 => {
90
+ holidays: [13]
91
+ },
92
+ 11 => {
93
+ holidays: [4]
94
+ }
50
95
  }
51
96
  }.freeze
52
97
 
@@ -76,6 +121,18 @@ module WorkCalendar
76
121
  date
77
122
  end
78
123
 
124
+ def first_workday_since(date = Time.zone.today)
125
+ return date if workday?(date)
126
+
127
+ _next_workday(date)
128
+ end
129
+
130
+ def last_workday_since(date = Time.zone.today)
131
+ return date if workday?(date)
132
+
133
+ _prev_workday(date)
134
+ end
135
+
79
136
  private
80
137
 
81
138
  def _next_workday(date)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: work_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Korenyushkin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-09-06 00:00:00.000000000 Z
12
+ date: 2021-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -114,7 +114,6 @@ files:
114
114
  - bin/setup
115
115
  - lib/work_calendar.rb
116
116
  - lib/work_calendar/version.rb
117
- - work_calendar-0.1.0.gem
118
117
  - work_calendar.gemspec
119
118
  homepage: https://github.com/toughbyte/work_calendar
120
119
  licenses:
@@ -137,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
136
  - !ruby/object:Gem::Version
138
137
  version: '0'
139
138
  requirements: []
140
- rubygems_version: 3.0.4
139
+ rubygems_version: 3.2.22
141
140
  signing_key:
142
141
  specification_version: 4
143
142
  summary: Workday calculator
Binary file