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.
data/lib/uddf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UDDF
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/uddf.rb CHANGED
@@ -8,7 +8,7 @@ require "uddf/version"
8
8
  # Universal Dive Data Format (UDDF) parser and validator
9
9
  module UDDF
10
10
  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
11
- SUPPORTED_PARSER_VERSIONS = %w[3.2.3 3.3.0 3.3.1].freeze
11
+ 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
12
12
 
13
13
  @schema_cache_mutex = Mutex.new
14
14
 
@@ -51,17 +51,12 @@ module UDDF
51
51
  def self.load_models_for_version(version)
52
52
  validate_version_support(version, :parse)
53
53
 
54
- case version
55
- when "3.2.3"
56
- require "uddf/v323/models"
57
- V323::Models::Uddf
58
- when "3.3.0"
59
- require "uddf/v330/models"
60
- V330::Models::Uddf
61
- when "3.3.1"
62
- require "uddf/v331/models"
63
- V331::Models::Uddf
64
- end
54
+ # convert version to module name ("3.2.3" -> "v323")
55
+ module_name = "v#{version.tr(".", "")}"
56
+
57
+ # require and load the module
58
+ require "uddf/#{module_name}/models"
59
+ const_get("#{module_name.upcase}::Models::Uddf")
65
60
  end
66
61
 
67
62
  def self.validate_version_support(version, operation)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uddf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flipez
@@ -170,11 +170,21 @@ files:
170
170
  - bin/setup
171
171
  - lib/uddf.rb
172
172
  - lib/uddf/base/models.rb
173
+ - lib/uddf/base/models/deco.rb
174
+ - lib/uddf/base/models/dive_computer.rb
175
+ - lib/uddf/base/models/generic.rb
176
+ - lib/uddf/base/models/media.rb
177
+ - lib/uddf/v300/models.rb
173
178
  - lib/uddf/v300/schema.xsd
179
+ - lib/uddf/v301/models.rb
174
180
  - lib/uddf/v301/schema.xsd
181
+ - lib/uddf/v310/models.rb
175
182
  - lib/uddf/v310/schema.xsd
183
+ - lib/uddf/v320/models.rb
176
184
  - lib/uddf/v320/schema.xsd
185
+ - lib/uddf/v321/models.rb
177
186
  - lib/uddf/v321/schema.xsd
187
+ - lib/uddf/v322/models.rb
178
188
  - lib/uddf/v322/schema.xsd
179
189
  - lib/uddf/v323/models.rb
180
190
  - lib/uddf/v323/schema.xsd