business 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -1
- data/lib/business/calendar.rb +1 -1
- data/lib/business/version.rb +1 -1
- data/spec/business/calendar_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecbb66616260ec96ece9868d9eb337e31fc3ffb791caf58b9f05010ebd7354dc
|
4
|
+
data.tar.gz: 2f13155d38f7fad38db25cbe49378af3166b2c99886379dc2b6c8a2dce7282c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13c43f3e262bac0402194d0c9bd98cbd5090b38ec2ed7cb25e66087c831127db1c313661672d74fdf4fe26f3073daab0d5377b345d8d71cfd5137173b2192b0d
|
7
|
+
data.tar.gz: eb039def7aceb3e4936940daaac94e8c2f64c9be8ae92fc776e5c77f3c8f8ceb315a5c6720ecec92c9b5ae7b55ab19dc9752e403d6957bc9cc141ad8a06efad8
|
data/CHANGELOG.md
CHANGED
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
|
```
|
data/lib/business/calendar.rb
CHANGED
@@ -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
|
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)
|
data/lib/business/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gc_ruboconfig
|