unitsdb 2.2.7 → 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/data/currencies.yaml +0 -13
- data/data/schemas/currencies-schema.yaml +2 -2
- 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 +2 -2
- 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
|
+
|
data/data/currencies.yaml
CHANGED
|
@@ -2947,7 +2947,6 @@ currencies:
|
|
|
2947
2947
|
names:
|
|
2948
2948
|
- value: "Silver (one troy ounce)"
|
|
2949
2949
|
lang: en
|
|
2950
|
-
minor_unit_exponent: 0
|
|
2951
2950
|
status: active
|
|
2952
2951
|
unit_system_reference:
|
|
2953
2952
|
- type: unitsml
|
|
@@ -2966,7 +2965,6 @@ currencies:
|
|
|
2966
2965
|
names:
|
|
2967
2966
|
- value: "Gold (one troy ounce)"
|
|
2968
2967
|
lang: en
|
|
2969
|
-
minor_unit_exponent: 0
|
|
2970
2968
|
status: active
|
|
2971
2969
|
unit_system_reference:
|
|
2972
2970
|
- type: unitsml
|
|
@@ -2985,7 +2983,6 @@ currencies:
|
|
|
2985
2983
|
names:
|
|
2986
2984
|
- value: "European Composite Unit (EURCO) (bond market unit)"
|
|
2987
2985
|
lang: en
|
|
2988
|
-
minor_unit_exponent: 0
|
|
2989
2986
|
status: active
|
|
2990
2987
|
unit_system_reference:
|
|
2991
2988
|
- type: unitsml
|
|
@@ -3004,7 +3001,6 @@ currencies:
|
|
|
3004
3001
|
names:
|
|
3005
3002
|
- value: "European Monetary Unit (E.M.U.-6) (bond market unit)"
|
|
3006
3003
|
lang: en
|
|
3007
|
-
minor_unit_exponent: 0
|
|
3008
3004
|
status: active
|
|
3009
3005
|
unit_system_reference:
|
|
3010
3006
|
- type: unitsml
|
|
@@ -3023,7 +3019,6 @@ currencies:
|
|
|
3023
3019
|
names:
|
|
3024
3020
|
- value: "European Unit of Account 9 (E.U.A.-9) (bond market unit)"
|
|
3025
3021
|
lang: en
|
|
3026
|
-
minor_unit_exponent: 0
|
|
3027
3022
|
status: active
|
|
3028
3023
|
unit_system_reference:
|
|
3029
3024
|
- type: unitsml
|
|
@@ -3042,7 +3037,6 @@ currencies:
|
|
|
3042
3037
|
names:
|
|
3043
3038
|
- value: "European Unit of Account 17 (E.U.A.-17) (bond market unit)"
|
|
3044
3039
|
lang: en
|
|
3045
|
-
minor_unit_exponent: 0
|
|
3046
3040
|
status: active
|
|
3047
3041
|
unit_system_reference:
|
|
3048
3042
|
- type: unitsml
|
|
@@ -3097,7 +3091,6 @@ currencies:
|
|
|
3097
3091
|
names:
|
|
3098
3092
|
- value: "Special drawing rights"
|
|
3099
3093
|
lang: en
|
|
3100
|
-
minor_unit_exponent: 0
|
|
3101
3094
|
status: active
|
|
3102
3095
|
unit_system_reference:
|
|
3103
3096
|
- type: unitsml
|
|
@@ -3134,7 +3127,6 @@ currencies:
|
|
|
3134
3127
|
names:
|
|
3135
3128
|
- value: "Palladium (one troy ounce)"
|
|
3136
3129
|
lang: en
|
|
3137
|
-
minor_unit_exponent: 0
|
|
3138
3130
|
status: active
|
|
3139
3131
|
unit_system_reference:
|
|
3140
3132
|
- type: unitsml
|
|
@@ -3171,7 +3163,6 @@ currencies:
|
|
|
3171
3163
|
names:
|
|
3172
3164
|
- value: "Platinum (one troy ounce)"
|
|
3173
3165
|
lang: en
|
|
3174
|
-
minor_unit_exponent: 0
|
|
3175
3166
|
status: active
|
|
3176
3167
|
unit_system_reference:
|
|
3177
3168
|
- type: unitsml
|
|
@@ -3190,7 +3181,6 @@ currencies:
|
|
|
3190
3181
|
names:
|
|
3191
3182
|
- value: "SUCRE"
|
|
3192
3183
|
lang: en
|
|
3193
|
-
minor_unit_exponent: 0
|
|
3194
3184
|
status: active
|
|
3195
3185
|
unit_system_reference:
|
|
3196
3186
|
- type: unitsml
|
|
@@ -3209,7 +3199,6 @@ currencies:
|
|
|
3209
3199
|
names:
|
|
3210
3200
|
- value: "Code reserved for testing"
|
|
3211
3201
|
lang: en
|
|
3212
|
-
minor_unit_exponent: 0
|
|
3213
3202
|
status: active
|
|
3214
3203
|
unit_system_reference:
|
|
3215
3204
|
- type: unitsml
|
|
@@ -3228,7 +3217,6 @@ currencies:
|
|
|
3228
3217
|
names:
|
|
3229
3218
|
- value: "ADB Unit of Account"
|
|
3230
3219
|
lang: en
|
|
3231
|
-
minor_unit_exponent: 0
|
|
3232
3220
|
status: active
|
|
3233
3221
|
unit_system_reference:
|
|
3234
3222
|
- type: unitsml
|
|
@@ -3247,7 +3235,6 @@ currencies:
|
|
|
3247
3235
|
names:
|
|
3248
3236
|
- value: "No currency"
|
|
3249
3237
|
lang: en
|
|
3250
|
-
minor_unit_exponent: 0
|
|
3251
3238
|
status: active
|
|
3252
3239
|
unit_system_reference:
|
|
3253
3240
|
- type: unitsml
|
|
@@ -21,7 +21,7 @@ properties:
|
|
|
21
21
|
definitions:
|
|
22
22
|
Currency:
|
|
23
23
|
type: object
|
|
24
|
-
required: ["identifiers", "names", "
|
|
24
|
+
required: ["identifiers", "names", "status", "unit_system_reference", "quantity_references"]
|
|
25
25
|
properties:
|
|
26
26
|
identifiers:
|
|
27
27
|
type: array
|
|
@@ -42,7 +42,7 @@ definitions:
|
|
|
42
42
|
type: integer
|
|
43
43
|
minimum: 0
|
|
44
44
|
maximum: 4
|
|
45
|
-
description: "Decimal exponent of the minor unit (2 = cents, 0 = JPY/KRW class, 3 = BHD/KWD class, 4 = CLF class)"
|
|
45
|
+
description: "Decimal exponent of the minor unit (2 = cents, 0 = JPY/KRW class, 3 = BHD/KWD class, 4 = CLF class). Absent = ISO 4217 publishes N.A.: the entry defines no minor unit at all (precious metals XAU/XAG/XPT/XPD, bond-market and unit-of-account codes, XDR/XSU/XUA, test codes) — distinct from 0, which means the minor unit exists and equals the unit itself. Historic (list three) codes carry no exponent either."
|
|
46
46
|
status:
|
|
47
47
|
type: string
|
|
48
48
|
enum: ["active", "historic"]
|
|
@@ -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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Unitsdb
|
|
4
|
-
VERSION = "2.2.
|
|
4
|
+
VERSION = "2.2.9"
|
|
5
5
|
|
|
6
6
|
# The version of the bundled UnitsDB data (from the data/ submodule).
|
|
7
7
|
# This version corresponds to a tag/commit in https://github.com/unitsml/unitsdb.
|
|
8
|
-
UNITS_DATA_VERSION = "2.0.
|
|
8
|
+
UNITS_DATA_VERSION = "2.0.2"
|
|
9
9
|
end
|
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
|