work_calendar 0.1.1 → 1.0.0

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: e4d98f999d5492b9a4c7da0391910e83a3ec1c0597686e921a8bc476bcd4a4db
4
+ data.tar.gz: 3c1d91955a99e92b4ccbfe5c19d2b5f210e49659668d5ab4dc0ce6e733d07c25
5
5
  SHA512:
6
- metadata.gz: b5b2fec2157a2fa6cb39a870912356c6acf2451c344dab372ede0c64a9da68aecd0e74fbd96940798d9385a225c6c5f6e41e827df74bb926e4f7ec2417400700
7
- data.tar.gz: 40afedcd00e8a2b482ae57562dad7598ceb7b444ee58d24c35de622245c1fb300080381507f20fbab47a30b6908b49daceeb65a3755a2bc2174700ad785f65c2
6
+ metadata.gz: 675a5a17f9c6c2611538b321875cf7e1744de61d0daa8c75d3ab9b7d6d509e3ba389e6dc83d5831cf69ed8fdbdec675556aa5a883befc11dcaca6b0b6b059015
7
+ data.tar.gz: 8bafacf8d20af90311b8e750f8847a57d7b719785ae6591fc5dc10bbe77a76cc1d89d4d3b6f7f0d1bd21f308bf3927fb85563274568146ded8910667863e58ae
data/.gitignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /work_calendar-*.gem
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- work_calendar (0.1.1)
4
+ work_calendar (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
@@ -76,6 +76,18 @@ module WorkCalendar
76
76
  date
77
77
  end
78
78
 
79
+ def first_workday_since(date = Time.zone.today)
80
+ return date if workday?(date)
81
+
82
+ _next_workday(date)
83
+ end
84
+
85
+ def last_workday_since(date = Time.zone.today)
86
+ return date if workday?(date)
87
+
88
+ _prev_workday(date)
89
+ end
90
+
79
91
  private
80
92
 
81
93
  def _next_workday(date)
@@ -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.0'
5
5
  end
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.0
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: 2019-11-06 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,8 @@ 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
+ rubyforge_project:
140
+ rubygems_version: 2.7.7
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Workday calculator
Binary file