unitsdb 0.1.1 → 2.0.1

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependent-repos.json +5 -0
  3. data/.github/workflows/depenedent-gems.yml +16 -0
  4. data/.gitmodules +3 -0
  5. data/.rspec +2 -1
  6. data/.rubocop_todo.yml +168 -15
  7. data/Gemfile +3 -2
  8. data/README.adoc +803 -1
  9. data/exe/unitsdb +7 -0
  10. data/lib/unitsdb/cli.rb +88 -0
  11. data/lib/unitsdb/commands/_modify.rb +22 -0
  12. data/lib/unitsdb/commands/base.rb +26 -0
  13. data/lib/unitsdb/commands/check_si.rb +124 -0
  14. data/lib/unitsdb/commands/get.rb +133 -0
  15. data/lib/unitsdb/commands/normalize.rb +81 -0
  16. data/lib/unitsdb/commands/release.rb +73 -0
  17. data/lib/unitsdb/commands/search.rb +219 -0
  18. data/lib/unitsdb/commands/si_formatter.rb +485 -0
  19. data/lib/unitsdb/commands/si_matcher.rb +470 -0
  20. data/lib/unitsdb/commands/si_ttl_parser.rb +100 -0
  21. data/lib/unitsdb/commands/si_updater.rb +212 -0
  22. data/lib/unitsdb/commands/ucum/check.rb +126 -0
  23. data/lib/unitsdb/commands/ucum/formatter.rb +141 -0
  24. data/lib/unitsdb/commands/ucum/matcher.rb +301 -0
  25. data/lib/unitsdb/commands/ucum/update.rb +84 -0
  26. data/lib/unitsdb/commands/ucum/updater.rb +98 -0
  27. data/lib/unitsdb/commands/ucum/xml_parser.rb +34 -0
  28. data/lib/unitsdb/commands/ucum.rb +43 -0
  29. data/lib/unitsdb/commands/validate/identifiers.rb +42 -0
  30. data/lib/unitsdb/commands/validate/references.rb +318 -0
  31. data/lib/unitsdb/commands/validate/si_references.rb +109 -0
  32. data/lib/unitsdb/commands/validate.rb +40 -0
  33. data/lib/unitsdb/config.rb +19 -0
  34. data/lib/unitsdb/database.rb +662 -0
  35. data/lib/unitsdb/dimension.rb +19 -25
  36. data/lib/unitsdb/dimension_details.rb +20 -0
  37. data/lib/unitsdb/dimension_reference.rb +8 -0
  38. data/lib/unitsdb/dimensions.rb +4 -6
  39. data/lib/unitsdb/errors.rb +13 -0
  40. data/lib/unitsdb/external_reference.rb +14 -0
  41. data/lib/unitsdb/identifier.rb +8 -0
  42. data/lib/unitsdb/localized_string.rb +17 -0
  43. data/lib/unitsdb/prefix.rb +11 -12
  44. data/lib/unitsdb/prefix_reference.rb +10 -0
  45. data/lib/unitsdb/prefixes.rb +4 -6
  46. data/lib/unitsdb/quantities.rb +4 -27
  47. data/lib/unitsdb/quantity.rb +12 -24
  48. data/lib/unitsdb/quantity_reference.rb +4 -7
  49. data/lib/unitsdb/root_unit_reference.rb +14 -0
  50. data/lib/unitsdb/scale.rb +17 -0
  51. data/lib/unitsdb/scale_properties.rb +12 -0
  52. data/lib/unitsdb/scale_reference.rb +10 -0
  53. data/lib/unitsdb/scales.rb +12 -0
  54. data/lib/unitsdb/si_derived_base.rb +13 -14
  55. data/lib/unitsdb/symbol_presentations.rb +14 -0
  56. data/lib/unitsdb/ucum.rb +198 -0
  57. data/lib/unitsdb/unit.rb +20 -26
  58. data/lib/unitsdb/unit_reference.rb +5 -8
  59. data/lib/unitsdb/unit_system.rb +8 -10
  60. data/lib/unitsdb/unit_system_reference.rb +10 -0
  61. data/lib/unitsdb/unit_systems.rb +4 -16
  62. data/lib/unitsdb/units.rb +4 -6
  63. data/lib/unitsdb/utils.rb +84 -0
  64. data/lib/unitsdb/version.rb +1 -1
  65. data/lib/unitsdb.rb +13 -10
  66. data/unitsdb.gemspec +6 -3
  67. metadata +120 -12
  68. data/lib/unitsdb/dimension_quantity.rb +0 -28
  69. data/lib/unitsdb/dimension_symbol.rb +0 -22
  70. data/lib/unitsdb/prefix_symbol.rb +0 -12
  71. data/lib/unitsdb/root_unit.rb +0 -17
  72. data/lib/unitsdb/root_units.rb +0 -20
  73. data/lib/unitsdb/symbol.rb +0 -17
  74. data/lib/unitsdb/unit_symbol.rb +0 -15
  75. data/lib/unitsdb/unitsdb.rb +0 -6
data/lib/unitsdb/unit.rb CHANGED
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "unit_system"
4
- require_relative "unit_symbol"
5
- require_relative "root_units"
3
+ require_relative "symbol_presentations"
4
+ require_relative "unit_system_reference"
5
+ require_relative "root_unit_reference"
6
6
  require_relative "si_derived_base"
7
7
  require_relative "quantity_reference"
8
+ require_relative "dimension_reference"
9
+ require_relative "external_reference"
10
+ require_relative "localized_string"
11
+ require_relative "scale_reference"
8
12
 
9
13
  # "NISTu10":
10
14
  # dimension_url: "#NISTd9"
@@ -13,7 +17,7 @@ require_relative "quantity_reference"
13
17
  # unit_system:
14
18
  # type: "SI_derived_special"
15
19
  # name: "SI"
16
- # unit_name:
20
+ # names:
17
21
  # - "steradian"
18
22
  # unit_symbols:
19
23
  # - id: "sr"
@@ -26,7 +30,7 @@ require_relative "quantity_reference"
26
30
  # enumerated_root_units:
27
31
  # - unit: "steradian"
28
32
  # power_denominator: 1
29
- # power_numerator: 1
33
+ # power: 1
30
34
  # quantity_reference:
31
35
  # - name: "solid angle"
32
36
  # url: "#NISTq11"
@@ -40,30 +44,20 @@ require_relative "quantity_reference"
40
44
 
41
45
  module Unitsdb
42
46
  class Unit < Lutaml::Model::Serializable
43
- attribute :id, :string
47
+ # model Config.model_for(:unit)
48
+
49
+ attribute :identifiers, Identifier, collection: true
44
50
  attribute :short, :string
45
51
  attribute :root, :boolean
46
52
  attribute :prefixed, :boolean
47
- attribute :dimension_url, :string
48
- attribute :unit_system, UnitSystem, collection: true
49
- attribute :unit_name, :string, collection: true
50
- attribute :unit_symbol, UnitSymbol, collection: true
51
- attribute :root_units, RootUnits, collection: true
52
- attribute :quantity_reference, QuantityReference, collection: true
53
+ attribute :dimension_reference, DimensionReference
54
+ attribute :unit_system_reference, UnitSystemReference, collection: true
55
+ attribute :names, LocalizedString, collection: true
56
+ attribute :symbols, SymbolPresentations, collection: true
57
+ attribute :quantity_references, QuantityReference, collection: true
53
58
  attribute :si_derived_bases, SiDerivedBase, collection: true
54
-
55
- key_value do
56
- map :id, to: :id
57
- map :dimension_url, to: :dimension_url
58
- map :short, to: :short, render_nil: true
59
- map :root, to: :root
60
- map :prefixed, to: :prefixed
61
- map :unit_system, to: :unit_system
62
- map :unit_name, to: :unit_name
63
- map :unit_symbols, to: :unit_symbol
64
- map :root_units, to: :root_units
65
- map :quantity_reference, to: :quantity_reference
66
- map :si_derived_bases, to: :si_derived_bases
67
- end
59
+ attribute :root_units, RootUnitReference, collection: true
60
+ attribute :references, ExternalReference, collection: true
61
+ attribute :scale_reference, ScaleReference
68
62
  end
69
63
  end
@@ -1,13 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Unitsdb
4
- class UnitReference < Lutaml::Model::Serializable
5
- attribute :name, :string
6
- attribute :url, :string
3
+ require_relative "identifier"
7
4
 
8
- key_value do
9
- map :name, to: :name
10
- map :url, to: :url
11
- end
5
+ module Unitsdb
6
+ class UnitReference < Identifier
7
+ attribute :id, :string
8
+ attribute :type, :string
12
9
  end
13
10
  end
@@ -1,17 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "identifier"
4
+ require_relative "localized_string"
5
+
3
6
  module Unitsdb
4
7
  class UnitSystem < Lutaml::Model::Serializable
5
- attribute :id, :string
6
- attribute :name, :string
7
- attribute :type, :string
8
- attribute :acceptable, :boolean
8
+ # model Config.model_for(:unit_system)
9
9
 
10
- key_value do
11
- map :id, to: :id
12
- map :type, to: :type
13
- map :name, to: :name
14
- map :acceptable, to: :acceptable
15
- end
10
+ attribute :identifiers, Identifier, collection: true
11
+ attribute :names, LocalizedString, collection: true
12
+ attribute :short, :string
13
+ attribute :acceptable, :boolean
16
14
  end
17
15
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "identifier"
4
+
5
+ module Unitsdb
6
+ class UnitSystemReference < Identifier
7
+ attribute :id, :string
8
+ attribute :type, :string
9
+ end
10
+ end
@@ -4,22 +4,10 @@ require_relative "unit_system"
4
4
 
5
5
  module Unitsdb
6
6
  class UnitSystems < Lutaml::Model::Serializable
7
- attribute :unit_system, UnitSystem, collection: true
7
+ # model Config.model_for(:unit_systems)
8
8
 
9
- # TODO: How do I parse this?
10
- # ---
11
- # - id: SI_base
12
- # name: SI
13
- # acceptable: true
14
- # - id: SI_derived_special
15
- # name: SI
16
- # acceptable: true
17
- # - id: SI_derived_non-special
18
-
19
- key_value do
20
- map to: :unit_system, root_mappings: {
21
- id: :key
22
- }
23
- end
9
+ attribute :schema_version, :string
10
+ attribute :version, :string
11
+ attribute :unit_systems, UnitSystem, collection: true
24
12
  end
25
13
  end
data/lib/unitsdb/units.rb CHANGED
@@ -4,12 +4,10 @@ require_relative "unit"
4
4
 
5
5
  module Unitsdb
6
6
  class Units < Lutaml::Model::Serializable
7
- attribute :units, Unit, collection: true
7
+ # model Config.model_for(:units)
8
8
 
9
- key_value do
10
- map to: :units, root_mappings: {
11
- id: :key,
12
- }
13
- end
9
+ attribute :schema_version, :string
10
+ attribute :version, :string
11
+ attribute :units, Unit, collection: true
14
12
  end
15
13
  end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ module Utils
5
+ DEFAULT_YAML_FILES = %w[dimensions prefixes quantities unit_systems units].map { |f| "#{f}.yaml" }
6
+
7
+ def self.levenshtein_distance(s, t)
8
+ m = s.length
9
+ n = t.length
10
+
11
+ return m if n.zero?
12
+ return n if m.zero?
13
+
14
+ d = Array.new(m + 1) { Array.new(n + 1) }
15
+
16
+ (0..m).each { |i| d[i][0] = i }
17
+ (0..n).each { |j| d[0][j] = j }
18
+
19
+ (1..n).each do |j|
20
+ (1..m).each do |i|
21
+ d[i][j] = if s[i - 1] == t[j - 1]
22
+ d[i - 1][j - 1]
23
+ else
24
+ [d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + 1].min
25
+ end
26
+ end
27
+ end
28
+
29
+ d[m][n]
30
+ end
31
+
32
+ def self.find_similar_ids(id, valid_ids, max_results = 5)
33
+ # Simple similarity measure based on Levenshtein distance
34
+ valid_ids
35
+ .map { |valid_id| [valid_id, levenshtein_distance(id.to_s, valid_id.to_s)] }
36
+ .sort_by { |_, distance| distance }
37
+ .take(max_results)
38
+ .select { |_, distance| distance < [id.to_s.length, 10].min }
39
+ .map { |valid_id, _| valid_id }
40
+ end
41
+
42
+ def self.sort_yaml_keys(obj)
43
+ case obj
44
+ when Hash
45
+ # Transform values first, then sort keys
46
+ obj.transform_values { |v| sort_yaml_keys(v) }
47
+ .sort_by do |key, _|
48
+ key_str = key.to_s
49
+
50
+ # Handle NIST IDs with proper category-based sorting
51
+ case key_str
52
+ when /\ANIST([a-z])(\d+)_(-?\d+)\Z/ # Prefixes with power (NISTp2_10)
53
+ [0, ::Regexp.last_match(1), ::Regexp.last_match(2).to_i, ::Regexp.last_match(3).to_i]
54
+ when /\ANIST([a-z])(\d+)\Z/ # Prefixes without power
55
+ [0, ::Regexp.last_match(1), ::Regexp.last_match(2).to_i, 0]
56
+ when %r{[/e]} # Composite IDs with '/' or 'e' to the end
57
+ [2, key_str]
58
+ when /\ANISTu(\d+)\.(.+)\Z/ # Simple unit IDs (NISTu10.1)
59
+ [1, "u", ::Regexp.last_match(1).to_i, ::Regexp.last_match(2)]
60
+ else
61
+ [3, key_str] # Everything else
62
+ end
63
+ end.to_h
64
+ when Array
65
+ # For arrays in the new structure, sort them if they're arrays of hashes with 'id' or 'short' keys
66
+ if !obj.empty? && obj.all? { |item| item.is_a?(Hash) }
67
+ # Sort by 'id' within identifiers array
68
+ if obj.first.key?("id") && obj.first.key?("type")
69
+ obj.sort_by { |item| item["id"].to_s }.map { |item| sort_yaml_keys(item) }
70
+ # Sort by 'short' for other arrays (like main unit arrays)
71
+ elsif obj.first.key?("short")
72
+ obj.sort_by { |item| item["short"].to_s }.map { |item| sort_yaml_keys(item) }
73
+ else
74
+ obj.map { |item| sort_yaml_keys(item) }
75
+ end
76
+ else
77
+ obj.map { |item| sort_yaml_keys(item) }
78
+ end
79
+ else
80
+ obj
81
+ end
82
+ end
83
+ end
84
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unitsdb
4
- VERSION = "0.1.1"
4
+ VERSION = "2.0.1"
5
5
  end
data/lib/unitsdb.rb CHANGED
@@ -2,17 +2,20 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- # Lutaml::Model::Config.configure do |config|
6
- # require "lutaml/model/xml_adapter/nokogiri_adapter"
7
- # config.xml_adapter = Lutaml::Model::XmlAdapter::NokogiriAdapter
8
- # end
9
-
10
- module Unitsdb
11
- class Error < StandardError; end
12
- end
13
-
14
5
  require_relative "unitsdb/version"
15
- require_relative "unitsdb/units"
6
+ require_relative "unitsdb/config"
7
+ require_relative "unitsdb/errors"
8
+ require_relative "unitsdb/database"
16
9
  require_relative "unitsdb/dimensions"
17
10
  require_relative "unitsdb/prefixes"
18
11
  require_relative "unitsdb/quantities"
12
+ require_relative "unitsdb/unit_systems"
13
+ require_relative "unitsdb/scales"
14
+ require_relative "unitsdb/units"
15
+ require_relative "unitsdb/utils"
16
+
17
+ # CLI-related requires
18
+ require_relative "unitsdb/cli" if defined?(Thor)
19
+
20
+ module Unitsdb
21
+ end
data/unitsdb.gemspec CHANGED
@@ -19,8 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.metadata["source_code_uri"] = spec.homepage
20
20
  spec.metadata["changelog_uri"] = "https://github.com/unitsml/unitsdb-ruby/releases"
21
21
 
22
- spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
23
-
24
22
  # Specify which files should be added to the gem when it is released.
25
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
24
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
@@ -33,5 +31,10 @@ Gem::Specification.new do |spec|
33
31
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
34
32
  spec.require_paths = ["lib"]
35
33
 
36
- spec.add_dependency "lutaml-model"
34
+ spec.add_dependency "lutaml-model", "~>0.7"
35
+ spec.add_dependency "rdf", "~> 3.1"
36
+ spec.add_dependency "rdf-turtle", "~> 3.1"
37
+ spec.add_dependency "rubyzip", "~> 2.3"
38
+ spec.add_dependency "terminal-table"
39
+ spec.add_dependency "thor", "~> 1.0"
37
40
  end
metadata CHANGED
@@ -1,17 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unitsdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-11 00:00:00.000000000 Z
11
+ date: 2025-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdf
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdf-turtle
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubyzip
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: terminal-table
15
71
  requirement: !ruby/object:Gem::Requirement
16
72
  requirements:
17
73
  - - ">="
@@ -24,16 +80,34 @@ dependencies:
24
80
  - - ">="
25
81
  - !ruby/object:Gem::Version
26
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: thor
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
27
97
  description: Library to handle UnitsDB content.
28
98
  email:
29
99
  - open.source@ribose.com
30
- executables: []
100
+ executables:
101
+ - unitsdb
31
102
  extensions: []
32
103
  extra_rdoc_files: []
33
104
  files:
105
+ - ".github/workflows/dependent-repos.json"
106
+ - ".github/workflows/depenedent-gems.yml"
34
107
  - ".github/workflows/rake.yml"
35
108
  - ".github/workflows/release.yml"
36
109
  - ".gitignore"
110
+ - ".gitmodules"
37
111
  - ".rspec"
38
112
  - ".rubocop.yml"
39
113
  - ".rubocop_todo.yml"
@@ -44,28 +118,62 @@ files:
44
118
  - Rakefile
45
119
  - bin/console
46
120
  - bin/setup
121
+ - exe/unitsdb
47
122
  - lib/unitsdb.rb
123
+ - lib/unitsdb/cli.rb
124
+ - lib/unitsdb/commands/_modify.rb
125
+ - lib/unitsdb/commands/base.rb
126
+ - lib/unitsdb/commands/check_si.rb
127
+ - lib/unitsdb/commands/get.rb
128
+ - lib/unitsdb/commands/normalize.rb
129
+ - lib/unitsdb/commands/release.rb
130
+ - lib/unitsdb/commands/search.rb
131
+ - lib/unitsdb/commands/si_formatter.rb
132
+ - lib/unitsdb/commands/si_matcher.rb
133
+ - lib/unitsdb/commands/si_ttl_parser.rb
134
+ - lib/unitsdb/commands/si_updater.rb
135
+ - lib/unitsdb/commands/ucum.rb
136
+ - lib/unitsdb/commands/ucum/check.rb
137
+ - lib/unitsdb/commands/ucum/formatter.rb
138
+ - lib/unitsdb/commands/ucum/matcher.rb
139
+ - lib/unitsdb/commands/ucum/update.rb
140
+ - lib/unitsdb/commands/ucum/updater.rb
141
+ - lib/unitsdb/commands/ucum/xml_parser.rb
142
+ - lib/unitsdb/commands/validate.rb
143
+ - lib/unitsdb/commands/validate/identifiers.rb
144
+ - lib/unitsdb/commands/validate/references.rb
145
+ - lib/unitsdb/commands/validate/si_references.rb
146
+ - lib/unitsdb/config.rb
147
+ - lib/unitsdb/database.rb
48
148
  - lib/unitsdb/dimension.rb
49
- - lib/unitsdb/dimension_quantity.rb
50
- - lib/unitsdb/dimension_symbol.rb
149
+ - lib/unitsdb/dimension_details.rb
150
+ - lib/unitsdb/dimension_reference.rb
51
151
  - lib/unitsdb/dimensions.rb
152
+ - lib/unitsdb/errors.rb
153
+ - lib/unitsdb/external_reference.rb
154
+ - lib/unitsdb/identifier.rb
155
+ - lib/unitsdb/localized_string.rb
52
156
  - lib/unitsdb/prefix.rb
53
- - lib/unitsdb/prefix_symbol.rb
157
+ - lib/unitsdb/prefix_reference.rb
54
158
  - lib/unitsdb/prefixes.rb
55
159
  - lib/unitsdb/quantities.rb
56
160
  - lib/unitsdb/quantity.rb
57
161
  - lib/unitsdb/quantity_reference.rb
58
- - lib/unitsdb/root_unit.rb
59
- - lib/unitsdb/root_units.rb
162
+ - lib/unitsdb/root_unit_reference.rb
163
+ - lib/unitsdb/scale.rb
164
+ - lib/unitsdb/scale_properties.rb
165
+ - lib/unitsdb/scale_reference.rb
166
+ - lib/unitsdb/scales.rb
60
167
  - lib/unitsdb/si_derived_base.rb
61
- - lib/unitsdb/symbol.rb
168
+ - lib/unitsdb/symbol_presentations.rb
169
+ - lib/unitsdb/ucum.rb
62
170
  - lib/unitsdb/unit.rb
63
171
  - lib/unitsdb/unit_reference.rb
64
- - lib/unitsdb/unit_symbol.rb
65
172
  - lib/unitsdb/unit_system.rb
173
+ - lib/unitsdb/unit_system_reference.rb
66
174
  - lib/unitsdb/unit_systems.rb
67
175
  - lib/unitsdb/units.rb
68
- - lib/unitsdb/unitsdb.rb
176
+ - lib/unitsdb/utils.rb
69
177
  - lib/unitsdb/version.rb
70
178
  - sig/unitsdb.rbs
71
179
  - unitsdb.gemspec
@@ -91,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
199
  - !ruby/object:Gem::Version
92
200
  version: '0'
93
201
  requirements: []
94
- rubygems_version: 3.3.27
202
+ rubygems_version: 3.5.22
95
203
  signing_key:
96
204
  specification_version: 4
97
205
  summary: Ruby library for UnitsDB
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "dimension_symbol"
4
- # NISTd1:
5
- # length:
6
- # powerNumerator: 1
7
- # symbol: L
8
- # dim_symbols:
9
- # - id: "dim_L"
10
- # ascii: "L"
11
- # html: "&#x1D5AB;"
12
- # mathml: "<mi mathvariant='sans-serif'>L</mi>"
13
- # latex: \ensuremath{\mathsf{L}}
14
- # unicode: "𝖫"
15
-
16
- module Unitsdb
17
- class DimensionQuantity < Lutaml::Model::Serializable
18
- attribute :power_numerator, :integer
19
- attribute :symbol, :string
20
- attribute :dim_symbols, DimensionSymbol, collection: true
21
-
22
- key_value do
23
- map :powerNumerator, to: :power_numerator
24
- map :symbol, to: :symbol
25
- map :dim_symbols, to: :dim_symbols
26
- end
27
- end
28
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "symbol"
4
-
5
- # - id: "dim_L"
6
- # ascii: "L"
7
- # html: "&#x1D5AB;"
8
- # mathml: "<mi mathvariant='sans-serif'>L</mi>"
9
- # latex: \ensuremath{\mathsf{L}}
10
- # unicode: "𝖫"
11
-
12
- module Unitsdb
13
- class DimensionSymbol < Symbol
14
- attribute :id, :string
15
- attribute :mathml, :string
16
-
17
- key_value do
18
- map :id, to: :id
19
- map :mathml, to: :mathml
20
- end
21
- end
22
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # symbol:
4
- # ascii: R
5
- # html: R
6
- # latex: R
7
- # unicode: R
8
-
9
- module Unitsdb
10
- class PrefixSymbol < Symbol
11
- end
12
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Unitsdb
4
- class RootUnit < Lutaml::Model::Serializable
5
- attribute :unit, :string
6
- attribute :power_denominator, :integer
7
- attribute :power_numerator, :integer
8
- attribute :prefix, :string
9
-
10
- key_value do
11
- map :unit, to: :unit
12
- map :power_denominator, to: :power_denominator
13
- map :power_numerator, to: :power_numerator
14
- map :prefix, to: :prefix
15
- end
16
- end
17
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "root_unit"
4
-
5
- module Unitsdb
6
- class RootUnits < Lutaml::Model::Serializable
7
- attribute :unit, :string
8
- attribute :power_denominator, :integer
9
- attribute :power_numerator, :integer
10
- attribute :enumerated_root_units, RootUnit, collection: true
11
-
12
- key_value do
13
- map :unit, to: :unit
14
- map :power_denominator, to: :power_denominator
15
- map :power_numerator, to: :power_numerator
16
- map :enumerated_root_units,
17
- to: :enumerated_root_units
18
- end
19
- end
20
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Unitsdb
4
- class Symbol < Lutaml::Model::Serializable
5
- attribute :ascii, :string
6
- attribute :html, :string
7
- attribute :latex, :string
8
- attribute :unicode, :string
9
-
10
- key_value do
11
- map :ascii, to: :ascii
12
- map :html, to: :html
13
- map :latex, to: :latex
14
- map :unicode, to: :unicode
15
- end
16
- end
17
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "symbol"
4
-
5
- module Unitsdb
6
- class UnitSymbol < Symbol
7
- attribute :id, :string
8
- attribute :mathml, :string
9
-
10
- key_value do
11
- map :id, to: :id
12
- map :mathml, to: :mathml
13
- end
14
- end
15
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Unitsdb
4
- class Error < StandardError; end
5
- # Your code goes here...
6
- end