en14960 0.2.1 → 0.2.3

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: 8dbb1531dc763837d2f9ddef55c5ae97ae4763b62bea5671d28a230b208c0fa1
4
- data.tar.gz: c471b3628a2dc6cf1b4157c04ddf03724aa1ade11f354367bb8c1f31b4d0e522
3
+ metadata.gz: fedeb5f36f6f2e3f2ac74b39a18ad7ead640a520917d4681abe23403a477de7f
4
+ data.tar.gz: 62b331bcad579a79b39039ba9a4fc8a3f8a15bef7bdf785e4e336434253e0112
5
5
  SHA512:
6
- metadata.gz: c035f45431a922e9b96260be0bd4bc9146adaa9aaf915554e63efa9bbf58889c1fee6a7793101ad9bd410d3483a40a28b771b29d24ffc913270153612204fccb
7
- data.tar.gz: 16f3ce2f5a590a0e6668c98c5207f2fba589307d31ae90fee8602fcce7994105efdc5ec60022c774b4ee8a41fb1aff93bbb98232cd232ccba87a705c2d21021e
6
+ metadata.gz: c0195422eb49e92201c750a030003620844f798426143b4ed8b58d80fd1ff277ae8e8d735bb2edea76ebf146b24669adf67a0750ebc1f81f7683e5de33cd782a
7
+ data.tar.gz: 8d0892f9d9c7522c43d4bfb8c7b16f80e947e8a36ea75b3126fcdf7e06470b3ecd6d6067a6515eec337fa739a2d98f9b218d3ad23b2ebae17a044494735ce223
@@ -5,32 +5,40 @@ module EN14960
5
5
  module PlayAreaValidator
6
6
  extend self
7
7
 
8
- def validate(unit_length:, unit_height:, play_area_length:, play_area_width:, negative_adjustment_area:)
8
+ def validate(
9
+ unit_length:,
10
+ unit_width:,
11
+ play_area_length:,
12
+ play_area_width:,
13
+ negative_adjustment_area:
14
+ )
9
15
  errors = []
10
16
 
11
- # Check for nil values
12
- if [unit_length, unit_height, play_area_length, play_area_width, negative_adjustment_area].any?(&:nil?)
13
- errors << "All measurements must be provided (non-nil)"
17
+ if [
18
+ unit_length,
19
+ unit_width,
20
+ play_area_length,
21
+ play_area_width,
22
+ negative_adjustment_area
23
+ ].any?(&:nil?)
24
+ errors << "All measurements must be provided"
14
25
  end
15
26
 
16
- # Return early if we have nil values
17
27
  return build_response(false, errors) unless errors.empty?
18
28
 
19
- # Convert all to floats for comparison
20
29
  unit_length = unit_length.to_f
21
- unit_height = unit_height.to_f
30
+ unit_width = unit_width.to_f
22
31
  play_area_length = play_area_length.to_f
23
32
  play_area_width = play_area_width.to_f
24
33
  negative_adjustment_area = negative_adjustment_area.to_f
25
34
 
26
- # Check play area length is less than unit height
27
- if play_area_length >= unit_height
28
- errors << "Play area length (#{play_area_length}) must be less than unit height (#{unit_height})"
35
+ if play_area_length > unit_length
36
+ errors << "Play area length (#{play_area_length}) must be less than or equal to unit length (#{unit_length})"
29
37
  end
30
38
 
31
- # Check play area width is less than unit length
32
- if play_area_width >= unit_length
33
- errors << "Play area width (#{play_area_width}) must be less than unit length (#{unit_length})"
39
+ # Check play area width is less than unit width
40
+ if play_area_width > unit_width
41
+ errors << "Play area width (#{play_area_width}) must be less than or equal to unit width (#{unit_width})"
34
42
  end
35
43
 
36
44
  # Calculate total play area
@@ -43,7 +51,7 @@ module EN14960
43
51
 
44
52
  build_response(errors.empty?, errors, {
45
53
  unit_length: unit_length,
46
- unit_height: unit_height,
54
+ unit_width: unit_width,
47
55
  play_area_length: play_area_length,
48
56
  play_area_width: play_area_width,
49
57
  total_play_area: total_play_area,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EN14960
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.3"
5
5
  end
data/lib/en14960.rb CHANGED
@@ -83,15 +83,21 @@ module EN14960
83
83
 
84
84
  # Validate play area measurements
85
85
  # @param unit_length [Float] Unit length
86
- # @param unit_height [Float] Unit height
86
+ # @param unit_width [Float] Unit width
87
87
  # @param play_area_length [Float] Play area length
88
88
  # @param play_area_width [Float] Play area width
89
89
  # @param negative_adjustment_area [Float] Negative adjustment area
90
90
  # @return [Hash] Validation result with errors and measurements
91
- def validate_play_area(unit_length:, unit_height:, play_area_length:, play_area_width:, negative_adjustment_area:)
91
+ def validate_play_area(
92
+ unit_length:,
93
+ unit_width:,
94
+ play_area_length:,
95
+ play_area_width:,
96
+ negative_adjustment_area:
97
+ )
92
98
  Validators::PlayAreaValidator.validate(
93
99
  unit_length: unit_length,
94
- unit_height: unit_height,
100
+ unit_width: unit_width,
95
101
  play_area_length: play_area_length,
96
102
  play_area_width: play_area_width,
97
103
  negative_adjustment_area: negative_adjustment_area
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: en14960
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chobble.com