unitsdb 2.2.8 → 2.2.9
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 +4 -4
- data/Gemfile +0 -1
- data/README.adoc +9 -0
- data/lib/unitsdb/canonical_conversion.rb +9 -0
- data/lib/unitsdb/database/loader.rb +7 -3
- data/lib/unitsdb/opal.rb +1 -0
- data/lib/unitsdb/scale.rb +1 -0
- data/lib/unitsdb/unit.rb +1 -0
- data/lib/unitsdb/version.rb +1 -1
- data/lib/unitsdb.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02e9966f9b73a990ff0c608a12bbe0671d94fb25b6d263bf919d2f631ff4585d
|
|
4
|
+
data.tar.gz: 710c16aba9a41c61a4af9f891f434a4b0b64b09789c1427f42cd2a47035a435c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 111baa323a50019347d6f2643236de1ff9eba13a8a7285d5d8c0140d7c47ea08b3d6dfe54fa286641651ab075ec964a04ad72fb274f2eab30cc1c6c1ea34b29f
|
|
7
|
+
data.tar.gz: 4d542496fb728459db62795ba6c8186144837c4671b73591f414f1764486f42f0290ac288017d398607347362c3307ed413cb9b673bc8d37bdf404fac8bdbd4d
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
|
@@ -1102,3 +1102,12 @@ without any additional setup.
|
|
|
1102
1102
|
== License
|
|
1103
1103
|
|
|
1104
1104
|
Copyright Ribose. BSD 2-clause license.
|
|
1105
|
+
|
|
1106
|
+
== JavaScript / TypeScript
|
|
1107
|
+
|
|
1108
|
+
The native JavaScript implementation of UnitsDB is the `unitsdb` package
|
|
1109
|
+
on npm (https://github.com/unitsml/unitsdb-ts[unitsml/unitsdb-ts]) —
|
|
1110
|
+
typed access to the same dataset, rebuilt from unitsdb releases. The
|
|
1111
|
+
former Opal-compiled `@unitsml/unitsdb` package is deprecated; its
|
|
1112
|
+
repository (unitsml/unitsdb-js) is archived.
|
|
1113
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
module Unitsdb
|
|
2
|
+
class CanonicalConversion < Lutaml::Model::Serializable
|
|
3
|
+
attribute :factor, :string
|
|
4
|
+
attribute :offset, :string
|
|
5
|
+
attribute :root_units, RootUnitReference, collection: true
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
Config.register_model(CanonicalConversion, id: :canonical_conversion)
|
|
9
|
+
end
|
|
@@ -27,7 +27,11 @@ module Unitsdb
|
|
|
27
27
|
|
|
28
28
|
DATABASE_FILES = REQUIRED_DATABASE_FILES.merge(OPTIONAL_DATABASE_FILES).freeze
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
SUPPORTED_SCHEMA_VERSIONS = %w[2.0.0 2.1.0].freeze
|
|
31
|
+
|
|
32
|
+
# Transitional: 2.1.0 adds optional canonical_conversion/operations
|
|
33
|
+
# fields only — 2.0.0 data remains valid.
|
|
34
|
+
SUPPORTED_SCHEMA_VERSION = SUPPORTED_SCHEMA_VERSIONS.last
|
|
31
35
|
|
|
32
36
|
def self.load(dir_path)
|
|
33
37
|
new(dir_path).load
|
|
@@ -112,11 +116,11 @@ module Unitsdb
|
|
|
112
116
|
end
|
|
113
117
|
|
|
114
118
|
version = versions.values.first
|
|
115
|
-
return version if version
|
|
119
|
+
return version if SUPPORTED_SCHEMA_VERSIONS.include?(version)
|
|
116
120
|
|
|
117
121
|
raise Errors::UnsupportedVersionError,
|
|
118
122
|
"Unsupported database version: #{version}. " \
|
|
119
|
-
"
|
|
123
|
+
"Supported versions: #{SUPPORTED_SCHEMA_VERSIONS.join(', ')}."
|
|
120
124
|
end
|
|
121
125
|
|
|
122
126
|
def build_database_hash(documents, schema_version)
|
data/lib/unitsdb/opal.rb
CHANGED
|
@@ -22,6 +22,7 @@ require "unitsdb/unit_system_reference"
|
|
|
22
22
|
require "unitsdb/scale_reference"
|
|
23
23
|
require "unitsdb/external_reference"
|
|
24
24
|
require "unitsdb/root_unit_reference"
|
|
25
|
+
require "unitsdb/canonical_conversion"
|
|
25
26
|
require "unitsdb/si_derived_base"
|
|
26
27
|
require "unitsdb/dimension_details"
|
|
27
28
|
require "unitsdb/dimension"
|
data/lib/unitsdb/scale.rb
CHANGED
data/lib/unitsdb/unit.rb
CHANGED
|
@@ -14,6 +14,7 @@ module Unitsdb
|
|
|
14
14
|
attribute :si_derived_bases, SiDerivedBase, collection: true
|
|
15
15
|
attribute :root_units, RootUnitReference, collection: true
|
|
16
16
|
attribute :references, ExternalReference, collection: true
|
|
17
|
+
attribute :canonical_conversion, CanonicalConversion
|
|
17
18
|
attribute :scale_reference, ScaleReference
|
|
18
19
|
end
|
|
19
20
|
|
data/lib/unitsdb/version.rb
CHANGED
data/lib/unitsdb.rb
CHANGED
|
@@ -28,6 +28,7 @@ module Unitsdb
|
|
|
28
28
|
autoload :ScaleReference, "unitsdb/scale_reference"
|
|
29
29
|
autoload :ExternalReference, "unitsdb/external_reference"
|
|
30
30
|
autoload :RootUnitReference, "unitsdb/root_unit_reference"
|
|
31
|
+
autoload :CanonicalConversion, "unitsdb/canonical_conversion"
|
|
31
32
|
autoload :SiDerivedBase, "unitsdb/si_derived_base"
|
|
32
33
|
autoload :DimensionDetails, "unitsdb/dimension_details"
|
|
33
34
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unitsdb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fuzzy_match
|
|
@@ -165,6 +165,7 @@ files:
|
|
|
165
165
|
- data/units.yaml
|
|
166
166
|
- exe/unitsdb
|
|
167
167
|
- lib/unitsdb.rb
|
|
168
|
+
- lib/unitsdb/canonical_conversion.rb
|
|
168
169
|
- lib/unitsdb/cli.rb
|
|
169
170
|
- lib/unitsdb/commands.rb
|
|
170
171
|
- lib/unitsdb/commands/_modify.rb
|