biz 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/biz/configuration.rb +2 -2
- data/lib/biz/time.rb +2 -2
- data/lib/biz/validation.rb +12 -12
- data/lib/biz/version.rb +1 -1
- 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: 3467afd950542680b2be1e34d7810a643f482e993bde21c63f972612885138d5
|
4
|
+
data.tar.gz: 195dc3df994b9a964b5682d6ed6b5174ce78b803ffa6a45a44034d33c0fc7f17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64f7b5fbedb898d6237edb853d80656cd7d511aa8bc91593fc8e2c181726a83675f3e2276231d92198118b9ab9189520f13981dda05192dc2bc1c155a6d79fde
|
7
|
+
data.tar.gz: eb583811538b0f27a5b78ba65db35c2c724110c7de99fa005f1593f1c5f654a9fdf1ce18b8addd062ffcc795a01f2b632307ba94588f763c283380dd36c7f0d5
|
data/lib/biz/configuration.rb
CHANGED
data/lib/biz/time.rb
CHANGED
@@ -14,8 +14,8 @@ module Biz
|
|
14
14
|
DAY_MINUTES = DAY_HOURS * HOUR_MINUTES
|
15
15
|
WEEK_MINUTES = WEEK_DAYS * DAY_MINUTES
|
16
16
|
|
17
|
-
BIG_BANG = ::Time.new(-
|
18
|
-
HEAT_DEATH = ::Time.new(
|
17
|
+
BIG_BANG = ::Time.new(-100_000_000).freeze
|
18
|
+
HEAT_DEATH = ::Time.new(100_000_000).freeze
|
19
19
|
|
20
20
|
private_constant :MINUTE_SECONDS,
|
21
21
|
:HOUR_MINUTES,
|
data/lib/biz/validation.rb
CHANGED
@@ -3,23 +3,23 @@
|
|
3
3
|
module Biz
|
4
4
|
class Validation
|
5
5
|
|
6
|
-
def self.perform(
|
7
|
-
new(
|
6
|
+
def self.perform(configuration)
|
7
|
+
new(configuration).perform
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize(
|
11
|
-
@
|
10
|
+
def initialize(configuration)
|
11
|
+
@configuration = configuration
|
12
12
|
end
|
13
13
|
|
14
14
|
def perform
|
15
|
-
RULES.each do |rule| rule.check(
|
15
|
+
RULES.each do |rule| rule.check(configuration) end
|
16
16
|
|
17
17
|
self
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
attr_reader :
|
22
|
+
attr_reader :configuration
|
23
23
|
|
24
24
|
class Rule
|
25
25
|
|
@@ -28,8 +28,8 @@ module Biz
|
|
28
28
|
@condition = condition
|
29
29
|
end
|
30
30
|
|
31
|
-
def check(
|
32
|
-
fail Error::Configuration, message
|
31
|
+
def check(configuration)
|
32
|
+
fail Error::Configuration, message if condition.call(configuration)
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
@@ -40,11 +40,11 @@ module Biz
|
|
40
40
|
end
|
41
41
|
|
42
42
|
RULES = [
|
43
|
-
Rule.new('hours not
|
44
|
-
|
43
|
+
Rule.new('hours not provided') { |configuration|
|
44
|
+
configuration.intervals.none?
|
45
45
|
},
|
46
|
-
Rule.new('hours
|
47
|
-
|
46
|
+
Rule.new('nonsensical hours provided') { |configuration|
|
47
|
+
configuration.intervals.any?(&:empty?)
|
48
48
|
}
|
49
49
|
].freeze
|
50
50
|
|
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.8.
|
4
|
+
version: 1.8.1
|
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: 2018-
|
12
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clavius
|