unitsdb 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) 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/lib/unitsdb/config.rb +19 -0
  5. data/lib/unitsdb/dimensions/dimension.rb +59 -0
  6. data/lib/unitsdb/dimensions/quantity.rb +32 -0
  7. data/lib/unitsdb/dimensions/symbol.rb +26 -0
  8. data/lib/unitsdb/dimensions.rb +7 -4
  9. data/lib/unitsdb/prefixes/prefix.rb +35 -0
  10. data/lib/unitsdb/prefixes/symbol.rb +17 -0
  11. data/lib/unitsdb/prefixes.rb +8 -4
  12. data/lib/unitsdb/{quantity.rb → quantities/quantity.rb} +12 -8
  13. data/lib/unitsdb/quantities/unit_reference.rb +15 -0
  14. data/lib/unitsdb/quantities.rb +7 -4
  15. data/lib/unitsdb/{symbol.rb → symbol_presentations.rb} +3 -1
  16. data/lib/unitsdb/unit_systems/unit_system.rb +19 -0
  17. data/lib/unitsdb/unit_systems.rb +6 -13
  18. data/lib/unitsdb/units/quantity_reference.rb +17 -0
  19. data/lib/unitsdb/units/root_unit.rb +21 -0
  20. data/lib/unitsdb/units/root_units.rb +18 -0
  21. data/lib/unitsdb/units/si_derived_base.rb +26 -0
  22. data/lib/unitsdb/units/symbol.rb +19 -0
  23. data/lib/unitsdb/units/system.rb +17 -0
  24. data/lib/unitsdb/units/unit.rb +73 -0
  25. data/lib/unitsdb/units.rb +5 -2
  26. data/lib/unitsdb/version.rb +1 -1
  27. data/lib/unitsdb.rb +2 -9
  28. metadata +21 -17
  29. data/lib/unitsdb/dimension.rb +0 -55
  30. data/lib/unitsdb/dimension_quantity.rb +0 -28
  31. data/lib/unitsdb/dimension_symbol.rb +0 -22
  32. data/lib/unitsdb/prefix.rb +0 -31
  33. data/lib/unitsdb/prefix_symbol.rb +0 -12
  34. data/lib/unitsdb/quantity_reference.rb +0 -13
  35. data/lib/unitsdb/root_unit.rb +0 -17
  36. data/lib/unitsdb/root_units.rb +0 -20
  37. data/lib/unitsdb/si_derived_base.rb +0 -20
  38. data/lib/unitsdb/unit.rb +0 -69
  39. data/lib/unitsdb/unit_reference.rb +0 -13
  40. data/lib/unitsdb/unit_symbol.rb +0 -15
  41. data/lib/unitsdb/unit_system.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 520380cf306ea06253c1d4e07b879bfac7b49e69f58514eb9cc5bc19b9c39b86
4
- data.tar.gz: f37a0ad8ac751a634ae851d018b3a3cdcaf8e6f866743bd93f84d5a36b7aba42
3
+ metadata.gz: 5a036c803ba8da7f845b70007e7472b55cf85f7a9de544c7b685fe34801f5876
4
+ data.tar.gz: 4f3911a631032c2fe688bbd33b49158f09feb88f2208106af5d022c9ecd57562
5
5
  SHA512:
6
- metadata.gz: d6188d494f447dc5893805555b0e7d0b9ae88e1728770215f98e41c7890b0cd183fcec7818705c4d23705eca895e83c9f8e11a21a95f2b9266baf26c9e0ef9e0
7
- data.tar.gz: b99151aa57387c0b60374a5d6cc657fec74c6f3a7c4d21887a7053910bf45912a578ff75380c9e612960d11f4a4535bcfdb24389fd22816815c654c8fc903ad8
6
+ metadata.gz: 446489baaa5df1b34402c43ca00354ec222cb4cd9e96aab1e5815c8716c2330ce37ad995a7f5f63d55e02c0eef7170a238928ef539c54a9bf426eeb58099e4ba
7
+ data.tar.gz: 3be2b704e450eb09b37dec01d500ad4bfbaf1c669513bc31e1ad124c17252b9dd77ad42df2c3aa71b19b8a09aa656b47ce2f2ebe1b25c5146f1871e6afa9dee5
@@ -0,0 +1,5 @@
1
+ {
2
+ "repo": [
3
+ "unitsml/unitsml-ruby"
4
+ ]
5
+ }
@@ -0,0 +1,16 @@
1
+ name: dependent-gems-test
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ tags: [ v* ]
7
+ pull_request:
8
+ workflow_dispatch:
9
+ repository_dispatch:
10
+ types: [ release-passed ]
11
+
12
+ jobs:
13
+ rake:
14
+ uses: metanorma/ci/.github/workflows/dependent-rake.yml@main
15
+ with:
16
+ command: bundle exec rspec
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ class Config
5
+ class << self
6
+ def models
7
+ @models ||= {}
8
+ end
9
+
10
+ def models=(user_models)
11
+ models.merge!(user_models)
12
+ end
13
+
14
+ def model_for(model_name)
15
+ models[model_name]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "quantity"
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
+ # NISTd9:
17
+ # -dimensionless: true
18
+ # -plane_angle:
19
+ # - dim_symbols:
20
+ # - - ascii: phi
21
+ # - html: "&#x1D785;"
22
+ # - id: dim_phi
23
+ # - latex: "\\ensuremath{\\mathsf{\\phi}}"
24
+ # - mathml: "<mi mathvariant='sans-serif'>&#x3c6;</mi>"
25
+ # - unicode: "\U0001D785"
26
+ # - powerNumerator: 1
27
+ # - symbol: phi
28
+
29
+ module Unitsdb
30
+ class Dimensions
31
+ class Dimension < Lutaml::Model::Serializable
32
+ model Config.model_for(:dimension)
33
+
34
+ attribute :id, :string
35
+ attribute :dimensionless, :boolean
36
+ attribute :length, Quantity
37
+ attribute :mass, Quantity
38
+ attribute :time, Quantity
39
+ attribute :electric_current, Quantity
40
+ attribute :thermodynamic_temperature, Quantity
41
+ attribute :amount_of_substance, Quantity
42
+ attribute :luminous_intensity, Quantity
43
+ attribute :plane_angle, Quantity
44
+
45
+ key_value do
46
+ map :id, to: :id
47
+ map :dimensionless, to: :dimensionless
48
+ map :length, to: :length
49
+ map :mass, to: :mass
50
+ map :time, to: :time
51
+ map :electric_current, to: :electric_current
52
+ map :thermodynamic_temperature, to: :thermodynamic_temperature
53
+ map :amount_of_substance, to: :amount_of_substance
54
+ map :luminous_intensity, to: :luminous_intensity
55
+ map :plane_angle, to: :plane_angle
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "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 Dimensions
18
+ class Quantity < Lutaml::Model::Serializable
19
+ model Config.model_for(:dimension_quantity)
20
+
21
+ attribute :power_numerator, :integer
22
+ attribute :symbol, :string
23
+ attribute :dim_symbols, Symbol, collection: true
24
+
25
+ key_value do
26
+ map :powerNumerator, to: :power_numerator
27
+ map :symbol, to: :symbol
28
+ map :dim_symbols, to: :dim_symbols
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../symbol_presentations"
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 Dimensions
14
+ class Symbol < SymbolPresentations
15
+ model Config.model_for(:dimension_symbol)
16
+
17
+ attribute :id, :string
18
+ attribute :mathml, :string
19
+
20
+ key_value do
21
+ map :id, to: :id
22
+ map :mathml, to: :mathml
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,13 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "dimension"
3
+ require_relative "dimensions/dimension"
4
4
 
5
5
  module Unitsdb
6
- class Dimensions < Lutaml::Model::Serializable
7
- attribute :dimension, Dimension, collection: true
6
+ class Dimensions
7
+ include Lutaml::Model::Serialize
8
+ model Config.model_for(:dimensions)
9
+
10
+ attribute :dimensions, Dimension, collection: true
8
11
 
9
12
  key_value do
10
- map to: :dimension, root_mappings: {
13
+ map to: :dimensions, root_mappings: {
11
14
  id: :key
12
15
  }
13
16
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "symbol"
4
+ # ---
5
+ # NISTp10_30:
6
+ # name: quetta
7
+ # symbol:
8
+ # ascii: Q
9
+ # html: Q
10
+ # latex: Q
11
+ # unicode: Q
12
+ # base: 10
13
+ # power: 30
14
+
15
+ module Unitsdb
16
+ class Prefixes
17
+ class Prefix < Lutaml::Model::Serializable
18
+ model Config.model_for(:prefix)
19
+
20
+ attribute :id, :string
21
+ attribute :name, :string
22
+ attribute :symbol, Symbol
23
+ attribute :base, :integer
24
+ attribute :power, :integer
25
+
26
+ key_value do
27
+ map :id, to: :id
28
+ map :name, to: :name
29
+ map :symbol, to: :symbol
30
+ map :base, to: :base
31
+ map :power, to: :power
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../symbol_presentations"
4
+
5
+ # symbol:
6
+ # ascii: R
7
+ # html: R
8
+ # latex: R
9
+ # unicode: R
10
+
11
+ module Unitsdb
12
+ class Prefixes
13
+ class Symbol < SymbolPresentations
14
+ model Config.model_for(:prefix_symbol)
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "prefix"
3
+ require_relative "prefixes/prefix"
4
4
  # ---
5
5
  # NISTp10_30:
6
6
  # name: quetta
@@ -13,11 +13,15 @@ require_relative "prefix"
13
13
  # power: 30
14
14
 
15
15
  module Unitsdb
16
- class Prefixes < Lutaml::Model::Serializable
17
- attribute :prefix, Prefix, collection: true
16
+ class Prefixes
17
+ include Lutaml::Model::Serialize
18
+
19
+ model Config.model_for(:prefixes)
20
+
21
+ attribute :prefixes, Prefix, collection: true
18
22
 
19
23
  key_value do
20
- map to: :prefix, root_mappings: {
24
+ map to: :prefixes, root_mappings: {
21
25
  id: :key
22
26
  }
23
27
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "unit_reference"
4
+
3
5
  # # Quantities
4
6
  # NISTq156:
5
7
  # dimension_url: "#NISTd68"
@@ -20,14 +22,16 @@
20
22
  # - name: inch to the fourth power
21
23
  # url: "#NISTu208"
22
24
 
23
- require_relative "unit_reference"
24
-
25
25
  module Unitsdb
26
- class Quantity < Lutaml::Model::Serializable
27
- attribute :id, :string
28
- attribute :dimension_url, :string
29
- attribute :quantity_type, :string
30
- attribute :quantity_name, :string, collection: true
31
- attribute :unit_reference, UnitReference, collection: true
26
+ class Quantities
27
+ class Quantity < Lutaml::Model::Serializable
28
+ model Config.model_for(:quantity)
29
+
30
+ attribute :id, :string
31
+ attribute :dimension_url, :string
32
+ attribute :quantity_type, :string
33
+ attribute :quantity_name, :string, collection: true
34
+ attribute :unit_reference, UnitReference, collection: true
35
+ end
32
36
  end
33
37
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ class Quantities
5
+ class UnitReference < Lutaml::Model::Serializable
6
+ attribute :name, :string
7
+ attribute :url, :string
8
+
9
+ key_value do
10
+ map :name, to: :name
11
+ map :url, to: :url
12
+ end
13
+ end
14
+ end
15
+ end
@@ -20,14 +20,17 @@
20
20
  # - name: inch to the fourth power
21
21
  # url: "#NISTu208"
22
22
 
23
- require_relative "quantity"
23
+ require_relative "quantities/quantity"
24
24
 
25
25
  module Unitsdb
26
- class Quantities < Lutaml::Model::Serializable
27
- attribute :quantity, Quantity, collection: true
26
+ class Quantities
27
+ include Lutaml::Model::Serialize
28
+ model Config.model_for(:quantities)
29
+
30
+ attribute :quantities, Quantity, collection: true
28
31
 
29
32
  key_value do
30
- map to: :quantity, root_mappings: {
33
+ map to: :quantities, root_mappings: {
31
34
  id: :key
32
35
  }
33
36
  end
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unitsdb
4
- class Symbol < Lutaml::Model::Serializable
4
+ class SymbolPresentations < Lutaml::Model::Serializable
5
+ model Config.model_for(:symbol_presentations)
6
+
5
7
  attribute :ascii, :string
6
8
  attribute :html, :string
7
9
  attribute :latex, :string
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ class UnitSystems
5
+ class UnitSystem < Lutaml::Model::Serializable
6
+ model Config.model_for(:unit_system)
7
+
8
+ attribute :id, :string
9
+ attribute :name, :string
10
+ attribute :acceptable, :boolean
11
+
12
+ key_value do
13
+ map :id, to: :id
14
+ map :name, to: :name
15
+ map :acceptable, to: :acceptable
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,23 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "unit_system"
3
+ require_relative "unit_systems/unit_system"
4
4
 
5
5
  module Unitsdb
6
- class UnitSystems < Lutaml::Model::Serializable
7
- attribute :unit_system, UnitSystem, collection: true
6
+ class UnitSystems
7
+ include Lutaml::Model::Serialize
8
+ model Config.model_for(:unit_systems)
8
9
 
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
10
+ attribute :unit_systems, UnitSystem, collection: true
18
11
 
19
12
  key_value do
20
- map to: :unit_system, root_mappings: {
13
+ map to: :unit_systems, root_mappings: {
21
14
  id: :key
22
15
  }
23
16
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ class Units
5
+ class QuantityReference < Lutaml::Model::Serializable
6
+ model Config.model_for(:quantity_reference)
7
+
8
+ attribute :name, :string
9
+ attribute :url, :string
10
+
11
+ key_value do
12
+ map :name, to: :name
13
+ map :url, to: :url
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ class Units
5
+ class RootUnit < Lutaml::Model::Serializable
6
+ model Config.model_for(:root_unit)
7
+
8
+ attribute :unit, :string
9
+ attribute :power_denominator, :integer
10
+ attribute :power_numerator, :integer
11
+ attribute :prefix, :string
12
+
13
+ key_value do
14
+ map :unit, to: :unit
15
+ map :power_denominator, to: :power_denominator
16
+ map :power_numerator, to: :power_numerator
17
+ map :prefix, to: :prefix
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "root_unit"
4
+
5
+ module Unitsdb
6
+ class Units
7
+ class RootUnits < Lutaml::Model::Serializable
8
+ model Config.model_for(:root_units)
9
+
10
+ attribute :enumerated_root_units, RootUnit, collection: true
11
+
12
+ key_value do
13
+ map :enumerated_root_units,
14
+ to: :enumerated_root_units
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # - id: NISTu1
4
+ # prefix:
5
+ # power: 1
6
+ # - id: NISTu1
7
+ # prefix:
8
+ # power: -1
9
+
10
+ module Unitsdb
11
+ class Units
12
+ class SiDerivedBase < Lutaml::Model::Serializable
13
+ model Config.model_for(:si_deribed_base)
14
+
15
+ attribute :id, :string
16
+ attribute :prefix, :string
17
+ attribute :power, :integer
18
+
19
+ key_value do
20
+ map :id, to: :id
21
+ map :prefix, to: :prefix, render_nil: true
22
+ map :power, to: :power
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../symbol_presentations"
4
+
5
+ module Unitsdb
6
+ class Units
7
+ class Symbol < SymbolPresentations
8
+ model Config.model_for(:unit_symbol)
9
+
10
+ attribute :id, :string
11
+ attribute :mathml, :string
12
+
13
+ key_value do
14
+ map :id, to: :id
15
+ map :mathml, to: :mathml
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsdb
4
+ class Units
5
+ class System < Lutaml::Model::Serializable
6
+ model Config.model_for(:system)
7
+
8
+ attribute :name, :string
9
+ attribute :type, :string
10
+
11
+ key_value do
12
+ map :type, to: :type
13
+ map :name, to: :name
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "symbol"
4
+ require_relative "system"
5
+ require_relative "root_units"
6
+ require_relative "si_derived_base"
7
+ require_relative "quantity_reference"
8
+
9
+ # "NISTu10":
10
+ # dimension_url: "#NISTd9"
11
+ # short: steradian
12
+ # root: true
13
+ # unit_system:
14
+ # type: "SI_derived_special"
15
+ # name: "SI"
16
+ # unit_name:
17
+ # - "steradian"
18
+ # unit_symbols:
19
+ # - id: "sr"
20
+ # ascii: "sr"
21
+ # html: "sr"
22
+ # mathml: "<mi mathvariant='normal'>sr</mi>"
23
+ # latex: \ensuremath{\mathrm{sr}}
24
+ # unicode: "sr"
25
+ # root_units:
26
+ # enumerated_root_units:
27
+ # - unit: "steradian"
28
+ # power_denominator: 1
29
+ # power_numerator: 1
30
+ # quantity_reference:
31
+ # - name: "solid angle"
32
+ # url: "#NISTq11"
33
+ # si_derived_bases:
34
+ # - id: NISTu1
35
+ # prefix:
36
+ # power: 1
37
+ # - id: NISTu1
38
+ # prefix:
39
+ # power: -1
40
+
41
+ module Unitsdb
42
+ class Units
43
+ class Unit < Lutaml::Model::Serializable
44
+ model Config.model_for(:unit)
45
+
46
+ attribute :id, :string
47
+ attribute :short, :string
48
+ attribute :root, :boolean
49
+ attribute :prefixed, :boolean
50
+ attribute :dimension_url, :string
51
+ attribute :unit_system, System
52
+ attribute :unit_name, :string, collection: true
53
+ attribute :unit_symbols, Symbol, collection: true
54
+ attribute :root_units, RootUnits, collection: true
55
+ attribute :quantity_reference, QuantityReference, collection: true
56
+ attribute :si_derived_bases, SiDerivedBase, collection: true
57
+
58
+ key_value do
59
+ map :id, to: :id
60
+ map :dimension_url, to: :dimension_url
61
+ map :short, to: :short, render_nil: true
62
+ map :root, to: :root
63
+ map :prefixed, to: :prefixed
64
+ map :unit_system, to: :unit_system
65
+ map :unit_name, to: :unit_name
66
+ map :unit_symbols, to: :unit_symbols
67
+ map :root_units, to: :root_units
68
+ map :quantity_reference, to: :quantity_reference
69
+ map :si_derived_bases, to: :si_derived_bases
70
+ end
71
+ end
72
+ end
73
+ end
data/lib/unitsdb/units.rb CHANGED
@@ -1,9 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "unit"
3
+ require "unitsdb/units/unit"
4
4
 
5
5
  module Unitsdb
6
- class Units < Lutaml::Model::Serializable
6
+ class Units
7
+ include Lutaml::Model::Serialize
8
+ model Config.model_for(:units)
9
+
7
10
  attribute :units, Unit, collection: true
8
11
 
9
12
  key_value do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unitsdb
4
- VERSION = "0.1.1"
4
+ VERSION = "1.0.0"
5
5
  end
data/lib/unitsdb.rb CHANGED
@@ -2,17 +2,10 @@
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"
6
+ require_relative "unitsdb/config"
15
7
  require_relative "unitsdb/units"
8
+ require_relative "unitsdb/unit_systems"
16
9
  require_relative "unitsdb/dimensions"
17
10
  require_relative "unitsdb/prefixes"
18
11
  require_relative "unitsdb/quantities"
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: 0.1.1
4
+ version: 1.0.0
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-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -31,6 +31,8 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".github/workflows/dependent-repos.json"
35
+ - ".github/workflows/depenedent-gems.yml"
34
36
  - ".github/workflows/rake.yml"
35
37
  - ".github/workflows/release.yml"
36
38
  - ".gitignore"
@@ -45,26 +47,28 @@ files:
45
47
  - bin/console
46
48
  - bin/setup
47
49
  - lib/unitsdb.rb
48
- - lib/unitsdb/dimension.rb
49
- - lib/unitsdb/dimension_quantity.rb
50
- - lib/unitsdb/dimension_symbol.rb
50
+ - lib/unitsdb/config.rb
51
51
  - lib/unitsdb/dimensions.rb
52
- - lib/unitsdb/prefix.rb
53
- - lib/unitsdb/prefix_symbol.rb
52
+ - lib/unitsdb/dimensions/dimension.rb
53
+ - lib/unitsdb/dimensions/quantity.rb
54
+ - lib/unitsdb/dimensions/symbol.rb
54
55
  - lib/unitsdb/prefixes.rb
56
+ - lib/unitsdb/prefixes/prefix.rb
57
+ - lib/unitsdb/prefixes/symbol.rb
55
58
  - lib/unitsdb/quantities.rb
56
- - lib/unitsdb/quantity.rb
57
- - lib/unitsdb/quantity_reference.rb
58
- - lib/unitsdb/root_unit.rb
59
- - lib/unitsdb/root_units.rb
60
- - lib/unitsdb/si_derived_base.rb
61
- - lib/unitsdb/symbol.rb
62
- - lib/unitsdb/unit.rb
63
- - lib/unitsdb/unit_reference.rb
64
- - lib/unitsdb/unit_symbol.rb
65
- - lib/unitsdb/unit_system.rb
59
+ - lib/unitsdb/quantities/quantity.rb
60
+ - lib/unitsdb/quantities/unit_reference.rb
61
+ - lib/unitsdb/symbol_presentations.rb
66
62
  - lib/unitsdb/unit_systems.rb
63
+ - lib/unitsdb/unit_systems/unit_system.rb
67
64
  - lib/unitsdb/units.rb
65
+ - lib/unitsdb/units/quantity_reference.rb
66
+ - lib/unitsdb/units/root_unit.rb
67
+ - lib/unitsdb/units/root_units.rb
68
+ - lib/unitsdb/units/si_derived_base.rb
69
+ - lib/unitsdb/units/symbol.rb
70
+ - lib/unitsdb/units/system.rb
71
+ - lib/unitsdb/units/unit.rb
68
72
  - lib/unitsdb/unitsdb.rb
69
73
  - lib/unitsdb/version.rb
70
74
  - sig/unitsdb.rbs
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "dimension_quantity"
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
- # NISTd9:
17
- # -dimensionless: true
18
- # -plane_angle:
19
- # - dim_symbols:
20
- # - - ascii: phi
21
- # - html: "&#x1D785;"
22
- # - id: dim_phi
23
- # - latex: "\\ensuremath{\\mathsf{\\phi}}"
24
- # - mathml: "<mi mathvariant='sans-serif'>&#x3c6;</mi>"
25
- # - unicode: "\U0001D785"
26
- # - powerNumerator: 1
27
- # - symbol: phi
28
-
29
- module Unitsdb
30
- class Dimension < Lutaml::Model::Serializable
31
- attribute :id, :string
32
- attribute :dimensionless, :boolean
33
- attribute :length, DimensionQuantity
34
- attribute :mass, DimensionQuantity
35
- attribute :time, DimensionQuantity
36
- attribute :electric_current, DimensionQuantity
37
- attribute :thermodynamic_temperature, DimensionQuantity
38
- attribute :amount_of_substance, DimensionQuantity
39
- attribute :luminous_intensity, DimensionQuantity
40
- attribute :plane_angle, DimensionQuantity
41
-
42
- key_value do
43
- map :id, to: :id
44
- map :dimensionless, to: :dimensionless
45
- map :length, to: :length
46
- map :mass, to: :mass
47
- map :time, to: :time
48
- map :electric_current, to: :electric_current
49
- map :thermodynamic_temperature, to: :thermodynamic_temperature
50
- map :amount_of_substance, to: :amount_of_substance
51
- map :luminous_intensity, to: :luminous_intensity
52
- map :plane_angle, to: :plane_angle
53
- end
54
- end
55
- end
@@ -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,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "prefix_symbol"
4
- # ---
5
- # NISTp10_30:
6
- # name: quetta
7
- # symbol:
8
- # ascii: Q
9
- # html: Q
10
- # latex: Q
11
- # unicode: Q
12
- # base: 10
13
- # power: 30
14
-
15
- module Unitsdb
16
- class Prefix < Lutaml::Model::Serializable
17
- attribute :id, :string
18
- attribute :name, :string
19
- attribute :symbol, PrefixSymbol
20
- attribute :base, :integer
21
- attribute :power, :integer
22
-
23
- key_value do
24
- map :id, to: :id
25
- map :name, to: :name
26
- map :symbol, to: :symbol
27
- map :base, to: :base
28
- map :power, to: :power
29
- end
30
- end
31
- 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,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Unitsdb
4
- class QuantityReference < Lutaml::Model::Serializable
5
- attribute :name, :string
6
- attribute :url, :string
7
-
8
- key_value do
9
- map :name, to: :name
10
- map :url, to: :url
11
- end
12
- end
13
- 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,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # - id: NISTu1
4
- # prefix:
5
- # power: 1
6
- # - id: NISTu1
7
- # prefix:
8
- # power: -1
9
-
10
- class SiDerivedBase < Lutaml::Model::Serializable
11
- attribute :id, :string
12
- attribute :prefix, :string
13
- attribute :power, :integer
14
-
15
- key_value do
16
- map :id, to: :id
17
- map :prefix, to: :prefix, render_nil: true
18
- map :power, to: :power
19
- end
20
- end
data/lib/unitsdb/unit.rb DELETED
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "unit_system"
4
- require_relative "unit_symbol"
5
- require_relative "root_units"
6
- require_relative "si_derived_base"
7
- require_relative "quantity_reference"
8
-
9
- # "NISTu10":
10
- # dimension_url: "#NISTd9"
11
- # short: steradian
12
- # root: true
13
- # unit_system:
14
- # type: "SI_derived_special"
15
- # name: "SI"
16
- # unit_name:
17
- # - "steradian"
18
- # unit_symbols:
19
- # - id: "sr"
20
- # ascii: "sr"
21
- # html: "sr"
22
- # mathml: "<mi mathvariant='normal'>sr</mi>"
23
- # latex: \ensuremath{\mathrm{sr}}
24
- # unicode: "sr"
25
- # root_units:
26
- # enumerated_root_units:
27
- # - unit: "steradian"
28
- # power_denominator: 1
29
- # power_numerator: 1
30
- # quantity_reference:
31
- # - name: "solid angle"
32
- # url: "#NISTq11"
33
- # si_derived_bases:
34
- # - id: NISTu1
35
- # prefix:
36
- # power: 1
37
- # - id: NISTu1
38
- # prefix:
39
- # power: -1
40
-
41
- module Unitsdb
42
- class Unit < Lutaml::Model::Serializable
43
- attribute :id, :string
44
- attribute :short, :string
45
- attribute :root, :boolean
46
- 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 :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
68
- end
69
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Unitsdb
4
- class UnitReference < Lutaml::Model::Serializable
5
- attribute :name, :string
6
- attribute :url, :string
7
-
8
- key_value do
9
- map :name, to: :name
10
- map :url, to: :url
11
- end
12
- end
13
- 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,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Unitsdb
4
- class UnitSystem < Lutaml::Model::Serializable
5
- attribute :id, :string
6
- attribute :name, :string
7
- attribute :type, :string
8
- attribute :acceptable, :boolean
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
16
- end
17
- end