biz 1.8.0 → 1.8.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: a7b79c92f3c6e05644da996c8c90a6cf7785a7dadd8bbb78c550c79f632091c5
4
- data.tar.gz: 896b6de71bc1c79a919cb7c9086caf5f22cfbd8ecf0a8274489e7afd3812ebb7
3
+ metadata.gz: 3467afd950542680b2be1e34d7810a643f482e993bde21c63f972612885138d5
4
+ data.tar.gz: 195dc3df994b9a964b5682d6ed6b5174ce78b803ffa6a45a44034d33c0fc7f17
5
5
  SHA512:
6
- metadata.gz: 8bbd2b8b8a835d68d4249a2545abdd43b82ba44decdc3cc9045ff70445e908a5fa72f4ce2ee9abb8aab341d30b1c9a191bf780a69045cc70361c5f810de478b8
7
- data.tar.gz: 0caa36b7677937f5d7b1fc92d58bc92310cbf7996976cca7a22afd1be976d9d62d78337d783d73aabf0baa2d161b1c3c77fa00fb2ae80822cb53e7f0c0810d26
6
+ metadata.gz: 64f7b5fbedb898d6237edb853d80656cd7d511aa8bc91593fc8e2c181726a83675f3e2276231d92198118b9ab9189520f13981dda05192dc2bc1c155a6d79fde
7
+ data.tar.gz: eb583811538b0f27a5b78ba65db35c2c724110c7de99fa005f1593f1c5f654a9fdf1ce18b8addd062ffcc795a01f2b632307ba94588f763c283380dd36c7f0d5
@@ -8,9 +8,9 @@ module Biz
8
8
 
9
9
  yield raw if block_given?
10
10
 
11
- Validation.perform(raw)
12
-
13
11
  raw.freeze
12
+
13
+ Validation.perform(self)
14
14
  end
15
15
 
16
16
  def intervals
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(-10**100).freeze
18
- HEAT_DEATH = ::Time.new(10**100).freeze
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,
@@ -3,23 +3,23 @@
3
3
  module Biz
4
4
  class Validation
5
5
 
6
- def self.perform(raw)
7
- new(raw).perform
6
+ def self.perform(configuration)
7
+ new(configuration).perform
8
8
  end
9
9
 
10
- def initialize(raw)
11
- @raw = raw
10
+ def initialize(configuration)
11
+ @configuration = configuration
12
12
  end
13
13
 
14
14
  def perform
15
- RULES.each do |rule| rule.check(raw) end
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 :raw
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(raw)
32
- fail Error::Configuration, message unless condition.call(raw)
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 hash-like') { |raw|
44
- raw.hours.respond_to?(:to_h)
43
+ Rule.new('hours not provided') { |configuration|
44
+ configuration.intervals.none?
45
45
  },
46
- Rule.new('hours not provided') { |raw|
47
- raw.hours.to_h.any?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Biz
4
- VERSION = '1.8.0'
4
+ VERSION = '1.8.1'
5
5
  end
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.0
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-09-14 00:00:00.000000000 Z
12
+ date: 2018-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clavius