uddf 0.3.0 → 0.4.0

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: f5921b223dcc3e5f11aa591f8d7c2d2a4750d648a479453987c7c3d880f8a5f5
4
- data.tar.gz: c370f0a496d02d07796ebf143f3cdf36ba8f46e4dd2b5ce4c28fdc43a72a2dc2
3
+ metadata.gz: d301729953487eba28cdbcf41f808000cdb8f4faae5b801bd6a6e35f48bac273
4
+ data.tar.gz: 2d87719ebd57aee09bb79d17810412de4a7c57a8f27379943cd6cf0aace53bac
5
5
  SHA512:
6
- metadata.gz: 1aaab5423b3bf1e2584b6f03a712f3c13c8dc915c8d9a9d398c2d1971a9a6109175a25fb282df1626fc00ac6e1a0a2a60ca31daeea2f2fc796d4e9b1859dce76
7
- data.tar.gz: 9b0f55690bf093b8650a0778905456b98bf560bfa72f89a0676c304c3d1ae767228430bd5865d178e8f0f2ba3e351f241d81e619c31d2e837ca7c45bd57e2f5c
6
+ metadata.gz: 6858549aa6fbfdeb6c14159a7249e83c4a946adfee3e2002679ae18b01b35c5acd053757a90ce0beb02e3e213ea0d6889af69d02b5e34971a8f5aa4c5205d7b5
7
+ data.tar.gz: 23cfb82b484f50b174dfc5c8e294999edfb0616faf059ff6a918ccf441a6951407df47db2456387c30c49a297b2ae6adf17b6a2f5dffe970d3188ff198f99ce0
data/.rubocop.yml CHANGED
@@ -29,7 +29,4 @@ Style/Documentation:
29
29
  Exclude:
30
30
  - "spec/**/*"
31
31
  - "test/**/*"
32
- - "lib/uddf/base/models.rb"
33
- - "lib/uddf/v323/models.rb"
34
- - "lib/uddf/v330/models.rb"
35
- - "lib/uddf/v331/models.rb"
32
+ - "lib/uddf/**/*"
data/.rubocop_todo.yml CHANGED
@@ -1,16 +1,11 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-08-23 14:52:40 UTC using RuboCop version 1.80.0.
3
+ # on 2025-08-24 15:31:53 UTC using RuboCop version 1.80.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 2
10
- Lint/ShadowedException:
11
- Exclude:
12
- - 'lib/uddf/base/models.rb'
13
-
14
9
  # Offense count: 4
15
10
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
16
11
  Metrics/AbcSize:
@@ -21,7 +16,7 @@ Metrics/AbcSize:
21
16
  Metrics/CyclomaticComplexity:
22
17
  Max: 8
23
18
 
24
- # Offense count: 3
19
+ # Offense count: 2
25
20
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
26
21
  Metrics/MethodLength:
27
22
  Max: 21
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- uddf (0.3.0)
4
+ uddf (0.4.0)
5
5
  nokogiri (~> 1.18)
6
6
  nokogiri-happymapper
7
7
 
data/README.md CHANGED
@@ -16,12 +16,12 @@ Ruby parser and validator for Universal Dive Data Format (UDDF) files. Supports
16
16
 
17
17
  | UDDF Version | Parser | Validator |
18
18
  |--------------|--------|-----------|
19
- | 3.0.0 | | ✓ |
20
- | 3.0.1 | | ✓ |
21
- | 3.1.0 | | ✓ |
22
- | 3.2.0 | | ✓ |
23
- | 3.2.1 | | ✓ |
24
- | 3.2.2 | | ✓ |
19
+ | 3.0.0 | | ✓ |
20
+ | 3.0.1 | | ✓ |
21
+ | 3.1.0 | | ✓ |
22
+ | 3.2.0 | | ✓ |
23
+ | 3.2.1 | | ✓ |
24
+ | 3.2.2 | | ✓ |
25
25
  | 3.2.3 | ✓ | ✓ |
26
26
  | 3.3.0 | ✓ | ✓ |
27
27
  | 3.3.1 | ✓ | ✓ |
@@ -62,6 +62,36 @@ end
62
62
  gem 'uddf'
63
63
  ```
64
64
 
65
+ ## Date Format Support
66
+
67
+ The UDDF parser supports multiple date/time formats in `<datetime>` elements:
68
+
69
+ | Format | Example | Description |
70
+ |--------|---------|-------------|
71
+ | **Full ISO 8601** | `2024-03-21T14:30:00Z` | Complete date and time with timezone |
72
+ | **Date only** | `2024-03-21` | ISO 8601 date format |
73
+ | **Year-Month** | `2024-03` | Year and month only (defaults to 1st day) |
74
+ | **Year only** | `2024` | Year only (defaults to January 1st) |
75
+ | **RFC 3339** | `2024-03-21T14:30:00+02:00` | RFC 3339 compliant timestamps |
76
+
77
+ ### Date Parsing Behavior
78
+
79
+ - **Year-only format** (`YYYY`): Parsed as January 1st of that year
80
+ - **Year-month format** (`YYYY-MM`): Parsed as the 1st day of that month
81
+ - **Empty dates**: Gracefully handled without throwing errors
82
+ - **Fallback parsing**: If ISO 8601 parsing fails, falls back to RFC 3339, then general date parsing
83
+
84
+ Example usage in UDDF files:
85
+ ```xml
86
+ <nextservicedate>
87
+ <datetime>2025-06</datetime> <!-- June 1st, 2025 -->
88
+ </nextservicedate>
89
+
90
+ <birthdate>
91
+ <datetime>1985</datetime> <!-- January 1st, 1985 -->
92
+ </birthdate>
93
+ ```
94
+
65
95
  ## Architecture
66
96
 
67
97
  The gem uses a modular architecture with version-specific models:
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UDDF
4
+ module Base
5
+ module Models
6
+ class Tissue
7
+ include HappyMapper
8
+
9
+ tag "tissue"
10
+
11
+ attribute :gas, String
12
+ attribute :half_life, Float, tag: "halflife"
13
+ attribute :number, Integer
14
+ attribute :a, Float
15
+ attribute :b, Float
16
+ end
17
+
18
+ class Hargikas
19
+ include HappyMapper
20
+
21
+ tag "hargikas"
22
+
23
+ has_one :ambient, Float
24
+ has_many :tissues, Tissue, tag: "tissue"
25
+ has_one :arterial_micro_bubble_level, Integer, tag: "arterialmicrobubbleLevel"
26
+ has_one :intrapulmonary_right_left_shunt, Float, tag: "intrapulmonaryrightleftshunt"
27
+ has_one :estimated_skin_cool_level, Integer, tag: "estimatedskincoolLevel"
28
+ end
29
+
30
+ class VPM
31
+ include HappyMapper
32
+
33
+ tag "vpm"
34
+
35
+ attribute :id, String
36
+ has_one :conservatism, Float
37
+ has_one :gamma, Float
38
+ has_one :gc, Float
39
+ has_one :lambda, Float
40
+ has_one :r0, Float
41
+ has_many :tissues, Tissue, tag: "tissue"
42
+ end
43
+
44
+ class RGBM
45
+ include HappyMapper
46
+
47
+ tag "rgbm"
48
+
49
+ attribute :id, String
50
+ has_many :tissues, Tissue, tag: "tissue"
51
+ end
52
+
53
+ class Buehlmann
54
+ include HappyMapper
55
+
56
+ tag "buehlmann"
57
+
58
+ attribute :id, String
59
+ has_many :tissues, Tissue, tag: "tissue"
60
+ end
61
+
62
+ class BuehlmannV320
63
+ include HappyMapper
64
+
65
+ tag "buehlmann"
66
+
67
+ attribute :id, String
68
+ has_one :gradient_factor_high, Float, tag: "gradientfactorhigh"
69
+ has_one :gradient_factor_low, Float, tag: "gradientfactorlow"
70
+ has_many :tissues, Tissue, tag: "tissue"
71
+ end
72
+
73
+ class DecoModel
74
+ include HappyMapper
75
+
76
+ tag "decomodel"
77
+
78
+ content :value, String
79
+ end
80
+
81
+ class DecoModelV310
82
+ include HappyMapper
83
+
84
+ tag "decomodel"
85
+
86
+ has_many :buehlmanns, Buehlmann, tag: "buehlmann"
87
+ has_many :rgbms, RGBM, tag: "rbgm"
88
+ has_many :vpms, VPM, tag: "vpm"
89
+ end
90
+
91
+ class DecoModelV320
92
+ include HappyMapper
93
+
94
+ tag "decomodel"
95
+
96
+ has_many :buehlmanns, BuehlmannV320, tag: "buehlmann"
97
+ has_many :rgbms, RGBM, tag: "rbgm"
98
+ has_many :vpms, VPM, tag: "vpm"
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,193 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UDDF
4
+ module Base
5
+ module Models
6
+ class DCAlarm
7
+ include HappyMapper
8
+
9
+ tag "dcalarm"
10
+
11
+ has_one :acknowledge, String
12
+ has_one :alarm_type, Integer, tag: "alarmtype"
13
+ has_one :period, Float
14
+ end
15
+
16
+ class SetDCDiveDepthAlarm
17
+ include HappyMapper
18
+
19
+ tag "setdcdivedethalarm"
20
+
21
+ has_one :dc_alarm, DCAlarm, tag: "dcalarm"
22
+ has_one :dc_alarm_depth, Float, tag: "dcalarmdepth"
23
+ end
24
+
25
+ class SetDCDivePo2Alarm
26
+ include HappyMapper
27
+
28
+ tag "setdcdivepo2alarm"
29
+
30
+ has_one :dc_alarm, DCAlarm, tag: "dcalarm"
31
+ has_one :maximum_po2, Float, tag: "maximumpo2"
32
+ end
33
+
34
+ class SetDCDiveSiteData
35
+ include HappyMapper
36
+
37
+ tag "setdcdivesitedata"
38
+
39
+ attribute :dive_site, String, tag: "divesite"
40
+ end
41
+
42
+ class SetDCDiveTimeAlarm
43
+ include HappyMapper
44
+
45
+ tag "setdcdivetimealarm"
46
+
47
+ has_one :dc_alarm, DCAlarm, tag: "dcalarm"
48
+ has_one :timespan, Float
49
+ end
50
+
51
+ class SetDCEndNDTAlarm
52
+ include HappyMapper
53
+
54
+ tag "setdcendndtalarm"
55
+
56
+ has_one :dc_alarm, DCAlarm, tag: "dcalarm"
57
+ end
58
+
59
+ class ApplicationDataV300
60
+ include HappyMapper
61
+
62
+ tag "applicationdata"
63
+
64
+ has_one :hargikas, Hargikas
65
+ end
66
+
67
+ class ApplicationDataV310 < ApplicationDataV300
68
+ include HappyMapper
69
+
70
+ tag "applicationdata"
71
+
72
+ has_one :deco_trainer, String, tag: "decotrainer"
73
+ end
74
+
75
+ class ApplicationDataV330 < ApplicationDataV310
76
+ include HappyMapper
77
+
78
+ has_one :apdiving, String
79
+ has_one :ratio, String
80
+ end
81
+
82
+ class SetDCDecoModelV300
83
+ include HappyMapper
84
+
85
+ tag "setdcdecomodel"
86
+
87
+ has_many :alias_names, String, tag: "aliasname"
88
+ has_one :application_data, ApplicationDataV300, tag: "applicationdata"
89
+ has_one :name, String
90
+ end
91
+
92
+ class SetDCDecoModelV310 < SetDCDecoModelV300
93
+ include HappyMapper
94
+
95
+ has_one :application_data, ApplicationDataV310, tag: "applicationdata"
96
+ end
97
+
98
+ class SetDCDecoModelV330 < SetDCDecoModelV310
99
+ include HappyMapper
100
+
101
+ has_one :application_data, ApplicationDataV330, tag: "applicationdata"
102
+ end
103
+
104
+ class SetDCBuddyData
105
+ include HappyMapper
106
+
107
+ tag "setdcbuddydata"
108
+
109
+ attribute :buddy, String
110
+ end
111
+
112
+ class SetDCDataV300
113
+ include HappyMapper
114
+
115
+ tag "setdcdata"
116
+
117
+ has_one :set_dc_alarm_time, DateTime, tag: "setdcalarmtime"
118
+ has_one :set_dc_altitude, Float, tag: "setdcaltitude"
119
+ has_one :set_dc_buddy_data, SetDCBuddyData, tag: "setdcbuddydata"
120
+ has_one :set_dc_date_time, DateTime, tag: "setdcdatetime"
121
+ has_one :set_dc_deco_model, SetDCDecoModelV300, tag: "setdcdecomodel"
122
+ has_one :set_dc_dive_depth_alarm, SetDCDiveDepthAlarm, tag: "setdcdivedethalarm"
123
+ has_one :set_dc_dive_po2_alarm, SetDCDivePo2Alarm, tag: "setdcdivepo2alarm"
124
+ has_many :set_dc_dive_site_data, SetDCDiveSiteData, tag: "setdcdivesitedata"
125
+ has_one :set_dc_dive_time_alarm, SetDCDiveTimeAlarm, tag: "setdcdivetimealarm"
126
+ has_one :set_dc_end_ndt_alarm, SetDCEndNDTAlarm, tag: "setdcendndtalarm"
127
+ has_one :set_dc_gas_definitions_data, String, tag: "setdcgasdefinitionsdata"
128
+ has_one :set_dc_owner_data, String, tag: "setdcownerdata"
129
+ has_one :set_dc_password, String, tag: "setdcpassword"
130
+ has_one :set_dc_generator_data, String, tag: "setdcgeneratordata"
131
+ end
132
+
133
+ class SetDCDataV310 < SetDCDataV300
134
+ include HappyMapper
135
+
136
+ has_one :set_dc_deco_model, SetDCDecoModelV310, tag: "setdcdecomodel"
137
+ end
138
+
139
+ class SetDCDataV330 < SetDCDataV310
140
+ include HappyMapper
141
+
142
+ has_one :set_dc_deco_model, SetDCDecoModelV330, tag: "setdcdecomodel"
143
+ end
144
+
145
+ class GetDCData
146
+ include HappyMapper
147
+
148
+ tag "getdcdata"
149
+
150
+ has_one :get_dc_all_data, String, tag: "getdcalldata"
151
+ has_one :get_dc_generator_data, String, tag: "getdcgeneratordata"
152
+ has_one :get_dc_owner_data, String, tag: "getdcownerdata"
153
+ has_one :get_dc_buddy_data, String, tag: "getdcbuddydata"
154
+ has_one :get_dc_gas_definitions_data, String, tag: "getdcgasdefinitionsdata"
155
+ has_one :get_dc_dive_site_data, String, tag: "getdcdivesitedata"
156
+ has_one :get_dc_dive_trip_data, String, tag: "getdcdivetripdata"
157
+ has_one :get_dc_profile_data, String, tag: "getdcprofiledata"
158
+ end
159
+
160
+ class DiveComputerDump
161
+ include HappyMapper
162
+
163
+ tag "divecomputerdump"
164
+
165
+ has_one :datetime, DateTime
166
+ has_one :dc_dump, String, tag: "dcdump"
167
+ has_one :link, Link
168
+ end
169
+
170
+ class DiveComputerControlV300
171
+ include HappyMapper
172
+
173
+ tag "divecomputercontrol"
174
+
175
+ has_many :dive_computer_dumps, DiveComputerDump, tag: "divecomputerdump"
176
+ has_one :get_dc_data, GetDCData, tag: "getdcdata"
177
+ has_one :set_dc_data, SetDCDataV300, tag: "setdcdata"
178
+ end
179
+
180
+ class DiveComputerControlV310 < DiveComputerControlV300
181
+ include HappyMapper
182
+
183
+ has_one :set_dc_data, SetDCDataV310, tag: "setdcdata"
184
+ end
185
+
186
+ class DiveComputerControlV330 < DiveComputerControlV310
187
+ include HappyMapper
188
+
189
+ has_one :set_dc_data, SetDCDataV330, tag: "setdcdata"
190
+ end
191
+ end
192
+ end
193
+ end