biz 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/biz.rb +1 -0
- data/lib/biz/calculation.rb +3 -2
- data/lib/biz/calculation/on_holiday.rb +21 -0
- data/lib/biz/core_ext/time.rb +4 -0
- data/lib/biz/schedule.rb +4 -0
- data/lib/biz/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fce08ec05e3857a5344b99ecd544e182ad1a877
|
4
|
+
data.tar.gz: db94653d507d2be6c3b6b2ea6ba12ea13c57afd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a55c8051f5980fc7ec592631bf597f72b66699820df7de97fab3b2dbffaab7a1db6bb81c4a59c5ec4794bf62a40b24e282c319a6a057ffab0612957c3a9d96d7
|
7
|
+
data.tar.gz: bac1486b182762a98ba869643e8271fb3cedc93a69f34579560f91b9e933125b5a5fafb085ad9002a05c027bba359259e431b4513db54bdca11cfc865ec2f384
|
data/README.md
CHANGED
@@ -84,6 +84,9 @@ Biz.within(Time.utc(2015, 3, 7), Time.utc(2015, 3, 14)).in_seconds
|
|
84
84
|
|
85
85
|
# Determine if a time is in business hours
|
86
86
|
Biz.in_hours?(Time.utc(2015, 1, 10, 9))
|
87
|
+
|
88
|
+
# Determine if a time is on a holiday
|
89
|
+
Biz.on_holiday?(Time.utc(2014, 1, 1))
|
87
90
|
```
|
88
91
|
|
89
92
|
Note that all returned times are in UTC.
|
@@ -135,6 +138,8 @@ require 'biz/core_ext'
|
|
135
138
|
|
136
139
|
Time.utc(2015, 8, 20, 9, 30).business_hours?
|
137
140
|
|
141
|
+
Time.utc(2014, 1, 1, 12).on_holiday?
|
142
|
+
|
138
143
|
Date.new(2015, 12, 10).business_day?
|
139
144
|
```
|
140
145
|
|
data/lib/biz.rb
CHANGED
data/lib/biz/calculation.rb
CHANGED
@@ -3,6 +3,7 @@ module Biz
|
|
3
3
|
end
|
4
4
|
end
|
5
5
|
|
6
|
-
require 'biz/calculation/for_duration'
|
7
|
-
require 'biz/calculation/duration_within'
|
8
6
|
require 'biz/calculation/active'
|
7
|
+
require 'biz/calculation/duration_within'
|
8
|
+
require 'biz/calculation/for_duration'
|
9
|
+
require 'biz/calculation/on_holiday'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Biz
|
2
|
+
module Calculation
|
3
|
+
class OnHoliday
|
4
|
+
|
5
|
+
def initialize(schedule, time)
|
6
|
+
@schedule = schedule
|
7
|
+
@time = time
|
8
|
+
end
|
9
|
+
|
10
|
+
def result
|
11
|
+
schedule.holidays.any? { |holiday| holiday.contains?(time) }
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
attr_reader :schedule,
|
17
|
+
:time
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/biz/core_ext/time.rb
CHANGED
data/lib/biz/schedule.rb
CHANGED
data/lib/biz/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: biz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig Little
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: abstract_type
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- lib/biz/calculation/active.rb
|
124
124
|
- lib/biz/calculation/duration_within.rb
|
125
125
|
- lib/biz/calculation/for_duration.rb
|
126
|
+
- lib/biz/calculation/on_holiday.rb
|
126
127
|
- lib/biz/configuration.rb
|
127
128
|
- lib/biz/core_ext.rb
|
128
129
|
- lib/biz/core_ext/date.rb
|