Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2025-08-23 14:52:40 UTC using RuboCop version 1.80.0.
# on 2025-08-24 10:08:03 UTC using RuboCop version 1.80.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -21,7 +21,7 @@ Metrics/AbcSize:
Metrics/CyclomaticComplexity:
Max: 8

# Offense count: 3
# Offense count: 2
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 21
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Ruby parser and validator for Universal Dive Data Format (UDDF) files. Supports

| UDDF Version | Parser | Validator |
|--------------|--------|-----------|
| 3.0.0 | | ✓ |
| 3.0.1 | | ✓ |
| 3.1.0 | | ✓ |
| 3.2.0 | | ✓ |
| 3.2.1 | | ✓ |
| 3.0.0 | | ✓ |
| 3.0.1 | | ✓ |
| 3.1.0 | | ✓ |
| 3.2.0 | | ✓ |
| 3.2.1 | | ✓ |
| 3.2.2 | ✓ | ✓ |
| 3.2.3 | ✓ | ✓ |
| 3.3.0 | ✓ | ✓ |
Expand Down
22 changes: 7 additions & 15 deletions lib/uddf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Universal Dive Data Format (UDDF) parser and validator
module UDDF
SUPPORTED_SCHEMA_VERSIONS = %w[3.0.0 3.0.1 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1].freeze
SUPPORTED_PARSER_VERSIONS = %w[3.2.2 3.2.3 3.3.0 3.3.1].freeze
SUPPORTED_PARSER_VERSIONS = %w[3.0.0 3.0.1 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1].freeze

@schema_cache_mutex = Mutex.new

Expand Down Expand Up @@ -51,20 +51,12 @@ def self.load_schema_for_version(version)
def self.load_models_for_version(version)
validate_version_support(version, :parse)

case version
when "3.2.2"
require "uddf/v322/models"
V322::Models::Uddf
when "3.2.3"
require "uddf/v323/models"
V323::Models::Uddf
when "3.3.0"
require "uddf/v330/models"
V330::Models::Uddf
when "3.3.1"
require "uddf/v331/models"
V331::Models::Uddf
end
# convert version to module name ("3.2.3" -> "v323")
module_name = "v#{version.tr(".", "")}"

# require and load the module
require "uddf/#{module_name}/models"
const_get("#{module_name.upcase}::Models::Uddf")
end

def self.validate_version_support(version, operation)
Expand Down
Loading