work_calendar 0.1.0 → 0.1.1

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: 8960c4113c6d74c1cbc16b1d2ea7cb58a4e1ba05a72b0a79ac242f18e04a2764
4
- data.tar.gz: 020e7536bf84ad209ede89b0da01c868acd96189032b46ebb568eedc059bd98e
3
+ metadata.gz: bf7bb9f5e0d3a093260f7300761a6a9a7eeb4044c6619b7b3a9a29522f142635
4
+ data.tar.gz: 14e439e03311e6213e00f7f18b318303dd3611e183d5d0cbcd92d18fd1d96ded
5
5
  SHA512:
6
- metadata.gz: e8af312727ff6f04c33c315aa591d0df5b744934ead8f1892cda699f2184f01a3a11fe802eb470222dd8ef24f5ce03aa5834ec4837352c7d44228080632ec9dc
7
- data.tar.gz: bc5a1d59dffeecc066534298d274611236c3a8f10ae10240a849ffc34c56626c2af1837ac209ff984c9b9f3cdf12a2d76c1d9744c453b3d8fcdd18f8fabbf1e9
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.0)
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.rc1)
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.4)
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 TODO: Write your name
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
- Works the same as `next_workday`, only looking backwards instead:
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(n, date)
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).
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkCalendar
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
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
- prev_date = date - 1.day
76
- prev_date -= 1.day until workday? prev_date
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
@@ -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 = ['sergey.tomashevsky@toughbyte.com']
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.0
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-08-30 00:00:00.000000000 Z
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
- - sergey.tomashevsky@toughbyte.com
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: