business 2.2.0 → 2.2.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: 9a053f4e9b8b8fa5ed407b58d1e81155dac75f1f0c305410403011c608c69c60
4
- data.tar.gz: 90cd733d6991516ae8c438824e669850d554147fbb47172f1c4f0dd0bdd44e37
3
+ metadata.gz: ecbb66616260ec96ece9868d9eb337e31fc3ffb791caf58b9f05010ebd7354dc
4
+ data.tar.gz: 2f13155d38f7fad38db25cbe49378af3166b2c99886379dc2b6c8a2dce7282c6
5
5
  SHA512:
6
- metadata.gz: f09af74f16a84326d8b193f219b1d4de9362c618d197977e4c887df49a34e73d9ad3db154cfe7606fa43b3017b4448175ac37e598ea497e8f508888cf3a2bdb2
7
- data.tar.gz: 9dc9a98ae02f7cb056af0bd710ac754594931c796d934b18695fafec5caecf1d7e4f107966863bc46d11e71e576b214cb774fd1a19dbe1d8c024483e55e27503
6
+ metadata.gz: 13c43f3e262bac0402194d0c9bd98cbd5090b38ec2ed7cb25e66087c831127db1c313661672d74fdf4fe26f3073daab0d5377b345d8d71cfd5137173b2192b0d
7
+ data.tar.gz: eb039def7aceb3e4936940daaac94e8c2f64c9be8ae92fc776e5c77f3c8f8ceb315a5c6720ecec92c9b5ae7b55ab19dc9752e403d6957bc9cc141ad8a06efad8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.2.1 - March 9, 2021
2
+
3
+ - Fix regression on `Calendar#new` #83 - thanks @ineu!
4
+
1
5
  ## 2.2.0 - March 4, 2021
2
6
 
3
7
  - Add `Business::Calendar#name` - thanks @mattmcf!
data/README.md CHANGED
@@ -52,10 +52,13 @@ gem "business", "~> 2.0"
52
52
 
53
53
  Get started with business by creating an instance of the calendar class, that accepts a hash that specifies which days of the week are considered working days, which days are holidays and which are extra working dates.
54
54
 
55
+ Additionally each calendar instance can be given a name. This can come in handy if you use multiple calendars.
56
+
55
57
  ```ruby
56
58
  calendar = Business::Calendar.new(
59
+ name: 'my calendar',
57
60
  working_days: %w( mon tue wed thu fri ),
58
- holidays: ["01/01/2014", "03/01/2014"] # array items are either parseable date strings, or real Date objects
61
+ holidays: ["01/01/2014", "03/01/2014"], # array items are either parseable date strings, or real Date objects
59
62
  extra_working_dates: [nil], # Makes the calendar to consider a weekend day as a working day.
60
63
  )
61
64
  ```
@@ -59,7 +59,7 @@ module Business
59
59
 
60
60
  attr_reader :name, :holidays, :working_days, :extra_working_dates
61
61
 
62
- def initialize(name:, extra_working_dates: nil, working_days: nil, holidays: nil)
62
+ def initialize(name: nil, extra_working_dates: nil, working_days: nil, holidays: nil)
63
63
  @name = name
64
64
  set_extra_working_dates(extra_working_dates)
65
65
  set_working_days(working_days)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Business
4
- VERSION = "2.2.0"
4
+ VERSION = "2.2.1"
5
5
  end
@@ -81,6 +81,18 @@ RSpec.describe Business::Calendar do
81
81
  end
82
82
  end
83
83
 
84
+ describe ".new" do
85
+ it "allows to skip a name" do
86
+ instance = described_class.new
87
+ expect(instance.name).to eq nil
88
+ end
89
+
90
+ it "allows to set a name" do
91
+ instance = described_class.new(name: "foo")
92
+ expect(instance.name).to eq "foo"
93
+ end
94
+ end
95
+
84
96
  describe "#set_working_days" do
85
97
  subject(:set_working_days) { calendar.set_working_days(working_days) }
86
98
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: business
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Marr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-04 00:00:00.000000000 Z
11
+ date: 2021-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gc_ruboconfig