unitsml 0.6.1 → 0.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc95997f58b3e086c0ef26a0a030d5f7158aac7f2456cf879d33078c40b2dcaf
4
- data.tar.gz: 9a687fa649e8f8ebcf0f42ed0cd29440f69ad64d1799ded6f4267ec2e36c9c96
3
+ metadata.gz: 519edb3bcbb3adee7983969d11be6a300340d782e8e305dae7622633b86e7677
4
+ data.tar.gz: 68becf0180daf138fc4f38048f052debef3d82433f4806d0f631c0c14e6ea852
5
5
  SHA512:
6
- metadata.gz: 10c82e86eef30472bda3d6e956f00627b523aada12f8dcd58499d7422c0c00e0a36b8c0a047f7093f47a294131425d3fb29699dbe25c345a7ea5f660deb0fb8d
7
- data.tar.gz: 29e5414746513fa0c13e459f4bf72c97b8e4e3246191f6650646443f1a10477929b9733d80d976ff866e58afe40033e4c1087254ba43a0b4a41ae55042bb63fc
6
+ metadata.gz: b6cb0077f5037893a02e69e6ff6c4b8a7c75ae3e67615897a4ccee3966349121bdaa1d8a8b244c42b6e9ba59898c6b2243a4c911239a54fd7f254a360208154a
7
+ data.tar.gz: 3fa4b5a9542487d7e502a18a22eca293664dc44b556cd9acca4e1bf589f6cd4d88daa9448b2ac18f37a678de4d63646e8f558ac128192d188a46efc56d5d27c6
data/.rubocop_todo.yml CHANGED
@@ -1,201 +1,50 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-04-03 23:07:18 UTC using RuboCop version 1.86.0.
3
+ # on 2026-04-04 03:19:03 UTC using RuboCop version 1.86.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 6
9
+ # Offense count: 2
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
11
  # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
12
12
  Bundler/OrderedGems:
13
13
  Exclude:
14
14
  - 'Gemfile'
15
15
 
16
- # Offense count: 1
17
- # This cop supports safe autocorrection (--autocorrect).
18
- Gemspec/RequireMFA:
19
- Exclude:
20
- - 'unitsml.gemspec'
21
-
22
16
  # Offense count: 1
23
17
  Gemspec/RequiredRubyVersion:
24
18
  Exclude:
25
19
  - 'unitsml.gemspec'
26
20
 
27
- # Offense count: 23
28
- # This cop supports safe autocorrection (--autocorrect).
29
- # Configuration parameters: EnforcedStyle, IndentationWidth.
30
- # SupportedStyles: with_first_argument, with_fixed_indentation
31
- Layout/ArgumentAlignment:
32
- Exclude:
33
- - 'lib/unitsml/formula.rb'
34
- - 'lib/unitsml/model/dimension_quantities.rb'
35
- - 'lib/unitsml/model/units/symbol.rb'
36
- - 'lib/unitsml/parse.rb'
37
- - 'lib/unitsml/unit.rb'
38
- - 'lib/unitsml/utility.rb'
39
- - 'spec/unitsml/conv/mathml_spec.rb'
40
- - 'spec/unitsml/conv/plurimath_spec.rb'
41
-
42
- # Offense count: 1
43
- # This cop supports safe autocorrection (--autocorrect).
44
- # Configuration parameters: EnforcedStyle, IndentationWidth.
45
- # SupportedStyles: with_first_element, with_fixed_indentation
46
- Layout/ArrayAlignment:
47
- Exclude:
48
- - 'lib/unitsml/unit.rb'
49
-
50
- # Offense count: 49
51
- # This cop supports safe autocorrection (--autocorrect).
52
- # Configuration parameters: EnforcedStyleAlignWith.
53
- # SupportedStylesAlignWith: either, start_of_block, start_of_line
54
- Layout/BlockAlignment:
55
- Exclude:
56
- - 'lib/unitsml/formula.rb'
57
- - 'lib/unitsml/intermediate_exp_rules.rb'
58
- - 'lib/unitsml/parse.rb'
59
- - 'lib/unitsml/prefix.rb'
60
- - 'lib/unitsml/unitsdb/dimension.rb'
61
- - 'lib/unitsml/utility.rb'
62
- - 'spec/unitsml/conv/html_spec.rb'
63
- - 'spec/unitsml/conv/latex_spec.rb'
64
- - 'spec/unitsml/conv/unicode_spec.rb'
65
- - 'spec/unitsml/parse_spec.rb'
66
- - 'unitsml.gemspec'
67
-
68
- # Offense count: 48
69
- # This cop supports safe autocorrection (--autocorrect).
70
- Layout/BlockEndNewline:
71
- Exclude:
72
- - 'lib/unitsml/formula.rb'
73
- - 'lib/unitsml/intermediate_exp_rules.rb'
74
- - 'lib/unitsml/parse.rb'
75
- - 'lib/unitsml/prefix.rb'
76
- - 'lib/unitsml/unitsdb/dimension.rb'
77
- - 'lib/unitsml/utility.rb'
78
- - 'spec/unitsml/conv/html_spec.rb'
79
- - 'spec/unitsml/conv/latex_spec.rb'
80
- - 'spec/unitsml/conv/unicode_spec.rb'
81
- - 'spec/unitsml/parse_spec.rb'
82
- - 'unitsml.gemspec'
83
-
84
- # Offense count: 2
85
- # This cop supports safe autocorrection (--autocorrect).
86
- Layout/ClosingParenthesisIndentation:
87
- Exclude:
88
- - 'lib/unitsml/parse.rb'
89
- - 'lib/unitsml/utility.rb'
90
-
91
- # Offense count: 2
92
- # This cop supports safe autocorrection (--autocorrect).
93
- # Configuration parameters: AllowForAlignment.
94
- Layout/CommentIndentation:
95
- Exclude:
96
- - 'spec/unitsml/conv/html_spec.rb'
97
-
98
- # Offense count: 2
99
- # This cop supports safe autocorrection (--autocorrect).
100
- Layout/EmptyLines:
101
- Exclude:
102
- - 'spec/unitsml/conv/mathml_spec.rb'
103
- - 'spec/unitsml/conv/xml_spec.rb'
104
-
105
- # Offense count: 2
106
- # This cop supports safe autocorrection (--autocorrect).
107
- # Configuration parameters: EnforcedStyle, IndentationWidth.
108
- # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
109
- Layout/FirstArgumentIndentation:
110
- Exclude:
111
- - 'lib/unitsml/parse.rb'
112
- - 'lib/unitsml/utility.rb'
113
-
114
- # Offense count: 11
115
- # This cop supports safe autocorrection (--autocorrect).
116
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
117
- # SupportedHashRocketStyles: key, separator, table
118
- # SupportedColonStyles: key, separator, table
119
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
120
- Layout/HashAlignment:
121
- Exclude:
122
- - 'lib/unitsml/formula.rb'
123
- - 'lib/unitsml/model/units/symbol.rb'
124
- - 'lib/unitsml/utility.rb'
125
- - 'spec/unitsml/conv/mathml_spec.rb'
126
-
127
- # Offense count: 7
128
- # This cop supports safe autocorrection (--autocorrect).
129
- # Configuration parameters: EnforcedStyle.
130
- # SupportedStyles: normal, indented_internal_methods
131
- Layout/IndentationConsistency:
132
- Exclude:
133
- - 'spec/unitsml/conv/html_spec.rb'
134
- - 'unitsml.gemspec'
135
-
136
- # Offense count: 97
137
- # This cop supports safe autocorrection (--autocorrect).
138
- # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
139
- # SupportedStylesAlignWith: start_of_line, relative_to_receiver
140
- Layout/IndentationWidth:
141
- Exclude:
142
- - 'lib/unitsml/formula.rb'
143
- - 'lib/unitsml/intermediate_exp_rules.rb'
144
- - 'lib/unitsml/parse.rb'
145
- - 'lib/unitsml/prefix.rb'
146
- - 'lib/unitsml/unitsdb/dimension.rb'
147
- - 'lib/unitsml/utility.rb'
148
- - 'spec/unitsml/conv/html_spec.rb'
149
- - 'spec/unitsml/conv/latex_spec.rb'
150
- - 'spec/unitsml/conv/unicode_spec.rb'
151
- - 'spec/unitsml/parse_spec.rb'
152
- - 'unitsml.gemspec'
153
-
154
- # Offense count: 148
21
+ # Offense count: 75
155
22
  # This cop supports safe autocorrection (--autocorrect).
156
23
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
157
24
  # URISchemes: http, https
158
25
  Layout/LineLength:
159
- Enabled: false
160
-
161
- # Offense count: 2
162
- # This cop supports safe autocorrection (--autocorrect).
163
- # Configuration parameters: EnforcedStyle.
164
- # SupportedStyles: symmetrical, new_line, same_line
165
- Layout/MultilineMethodCallBraceLayout:
166
- Exclude:
167
- - 'lib/unitsml/parse.rb'
168
- - 'lib/unitsml/utility.rb'
169
-
170
- # Offense count: 6
171
- # This cop supports safe autocorrection (--autocorrect).
172
- # Configuration parameters: EnforcedStyle, IndentationWidth.
173
- # SupportedStyles: aligned, indented, indented_relative_to_receiver
174
- Layout/MultilineMethodCallIndentation:
175
- Exclude:
176
- - 'lib/unitsml/utility.rb'
177
-
178
- # Offense count: 23
179
- # This cop supports safe autocorrection (--autocorrect).
180
- # Configuration parameters: AllowInHeredoc.
181
- Layout/TrailingWhitespace:
182
26
  Exclude:
27
+ - 'lib/unitsml/fenced.rb'
183
28
  - 'lib/unitsml/formula.rb'
184
- - 'lib/unitsml/model/dimension_quantities.rb'
185
- - 'lib/unitsml/model/units/symbol.rb'
29
+ - 'lib/unitsml/intermediate_exp_rules.rb'
186
30
  - 'lib/unitsml/parse.rb'
31
+ - 'lib/unitsml/parser.rb'
187
32
  - 'lib/unitsml/unit.rb'
33
+ - 'lib/unitsml/unitsdb/dimensions.rb'
188
34
  - 'lib/unitsml/utility.rb'
35
+ - 'spec/unitsml/conv/html_spec.rb'
36
+ - 'spec/unitsml/conv/latex_spec.rb'
189
37
  - 'spec/unitsml/conv/mathml_spec.rb'
190
38
  - 'spec/unitsml/conv/plurimath_spec.rb'
39
+ - 'spec/unitsml/conv/unicode_spec.rb'
40
+ - 'spec/unitsml/conv/xml_spec.rb'
41
+ - 'unitsml.gemspec'
191
42
 
192
- # Offense count: 21
193
- # This cop supports safe autocorrection (--autocorrect).
194
- Lint/AmbiguousOperatorPrecedence:
43
+ # Offense count: 3
44
+ Lint/ReturnInVoidContext:
195
45
  Exclude:
196
- - 'lib/unitsml/intermediate_exp_rules.rb'
197
- - 'lib/unitsml/parse.rb'
198
- - 'lib/unitsml/utility.rb'
46
+ - 'lib/unitsml/unitsdb/si_derived_base.rb'
47
+ - 'lib/unitsml/unitsdb/unit.rb'
199
48
 
200
49
  # Offense count: 19
201
50
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
@@ -249,37 +98,11 @@ Performance/CollectionLiteralInLoop:
249
98
  Exclude:
250
99
  - 'lib/unitsml/parser.rb'
251
100
 
252
- # Offense count: 1
253
- # This cop supports unsafe autocorrection (--autocorrect-all).
254
- Performance/MapCompact:
255
- Exclude:
256
- - 'lib/unitsml/utility.rb'
257
-
258
- # Offense count: 1
259
- # This cop supports safe autocorrection (--autocorrect).
260
- Performance/RedundantMatch:
261
- Exclude:
262
- - 'lib/unitsml/formula.rb'
263
-
264
- # Offense count: 2
265
- # This cop supports safe autocorrection (--autocorrect).
266
- Performance/RegexpMatch:
267
- Exclude:
268
- - 'lib/unitsml/formula.rb'
269
-
270
101
  # Offense count: 1
271
102
  RSpec/AnyInstance:
272
103
  Exclude:
273
104
  - 'spec/unitsml/conv/plurimath_spec.rb'
274
105
 
275
- # Offense count: 1
276
- # This cop supports safe autocorrection (--autocorrect).
277
- # Configuration parameters: EnforcedStyle.
278
- # SupportedStyles: be, be_nil
279
- RSpec/BeNil:
280
- Exclude:
281
- - 'spec/unitsml_spec.rb'
282
-
283
106
  # Offense count: 2
284
107
  RSpec/BeforeAfterAll:
285
108
  Exclude:
@@ -301,41 +124,15 @@ RSpec/ContextWording:
301
124
  - 'spec/unitsml/parse_spec.rb'
302
125
  - 'spec/unitsml/parser_spec.rb'
303
126
 
304
- # Offense count: 26
305
- # This cop supports safe autocorrection (--autocorrect).
306
- RSpec/EmptyLineAfterFinalLet:
307
- Exclude:
308
- - 'spec/unitsml/conv/mathml_spec.rb'
309
-
310
- # Offense count: 3
311
- # This cop supports safe autocorrection (--autocorrect).
312
- RSpec/EmptyLineAfterSubject:
313
- Exclude:
314
- - 'spec/unitsml/conv/mathml_spec.rb'
315
- - 'spec/unitsml/conv/xml_spec.rb'
316
-
317
127
  # Offense count: 5
318
128
  # Configuration parameters: CountAsOne.
319
129
  RSpec/ExampleLength:
320
130
  Max: 7
321
131
 
322
- # Offense count: 4
323
- # This cop supports safe autocorrection (--autocorrect).
324
- RSpec/LeadingSubject:
325
- Exclude:
326
- - 'spec/unitsml/conv/mathml_spec.rb'
327
- - 'spec/unitsml/conv/xml_spec.rb'
328
-
329
132
  # Offense count: 15
330
133
  RSpec/MultipleExpectations:
331
134
  Max: 6
332
135
 
333
- # Offense count: 1
334
- # This cop supports safe autocorrection (--autocorrect).
335
- RSpec/MultipleSubjects:
336
- Exclude:
337
- - 'spec/unitsml/conv/mathml_spec.rb'
338
-
339
136
  # Offense count: 12
340
137
  RSpec/RepeatedExampleGroupBody:
341
138
  Exclude:
@@ -363,39 +160,6 @@ RSpec/SpecFilePathFormat:
363
160
  - 'spec/unitsml/conv/unicode_spec.rb'
364
161
  - 'spec/unitsml/conv/xml_spec.rb'
365
162
 
366
- # Offense count: 83
367
- # This cop supports safe autocorrection (--autocorrect).
368
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
369
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
370
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
371
- # FunctionalMethods: let, let!, subject, watch
372
- # AllowedMethods: lambda, proc, it
373
- Style/BlockDelimiters:
374
- Exclude:
375
- - 'lib/unitsml/formula.rb'
376
- - 'lib/unitsml/intermediate_exp_rules.rb'
377
- - 'lib/unitsml/parse.rb'
378
- - 'lib/unitsml/prefix.rb'
379
- - 'lib/unitsml/unitsdb/dimension.rb'
380
- - 'lib/unitsml/utility.rb'
381
- - 'spec/unitsml/conv/html_spec.rb'
382
- - 'spec/unitsml/conv/latex_spec.rb'
383
- - 'spec/unitsml/conv/unicode_spec.rb'
384
- - 'spec/unitsml/parse_spec.rb'
385
- - 'unitsml.gemspec'
386
-
387
- # Offense count: 2
388
- # This cop supports safe autocorrection (--autocorrect).
389
- Style/MultilineIfModifier:
390
- Exclude:
391
- - 'lib/unitsml/formula.rb'
392
-
393
- # Offense count: 3
394
- # This cop supports safe autocorrection (--autocorrect).
395
- Style/NegatedIfElseCondition:
396
- Exclude:
397
- - 'lib/unitsml/utility.rb'
398
-
399
163
  # Offense count: 2
400
164
  # Configuration parameters: AllowedMethods.
401
165
  # AllowedMethods: respond_to_missing?
@@ -404,31 +168,6 @@ Style/OptionalBooleanParameter:
404
168
  - 'lib/unitsml/parser.rb'
405
169
  - 'lib/unitsml/prefix.rb'
406
170
 
407
- # Offense count: 1
408
- # This cop supports unsafe autocorrection (--autocorrect-all).
409
- Style/ReduceToHash:
410
- Exclude:
411
- - 'lib/unitsml/utility.rb'
412
-
413
- # Offense count: 1
414
- # This cop supports unsafe autocorrection (--autocorrect-all).
415
- # Configuration parameters: Methods.
416
- Style/RedundantArgument:
417
- Exclude:
418
- - 'lib/unitsml/utility.rb'
419
-
420
- # Offense count: 6
421
- # This cop supports safe autocorrection (--autocorrect).
422
- Style/RedundantConstantBase:
423
- Exclude:
424
- - 'lib/unitsml.rb'
425
-
426
- # Offense count: 3
427
- # This cop supports safe autocorrection (--autocorrect).
428
- Style/RedundantRegexpArgument:
429
- Exclude:
430
- - 'lib/unitsml/utility.rb'
431
-
432
171
  # Offense count: 2
433
172
  # Configuration parameters: Max.
434
173
  Style/SafeNavigationChainLength:
@@ -442,54 +181,3 @@ Style/SafeNavigationChainLength:
442
181
  Style/StringConcatenation:
443
182
  Exclude:
444
183
  - 'lib/unitsml/utility.rb'
445
-
446
- # Offense count: 2141
447
- # This cop supports safe autocorrection (--autocorrect).
448
- # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
449
- # SupportedStyles: single_quotes, double_quotes
450
- Style/StringLiterals:
451
- Enabled: false
452
-
453
- # Offense count: 258
454
- # This cop supports safe autocorrection (--autocorrect).
455
- # Configuration parameters: EnforcedStyleForMultiline.
456
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
457
- Style/TrailingCommaInArguments:
458
- Exclude:
459
- - 'lib/unitsml.rb'
460
- - 'lib/unitsml/dimension.rb'
461
- - 'lib/unitsml/number.rb'
462
- - 'lib/unitsml/parser.rb'
463
- - 'lib/unitsml/prefix.rb'
464
- - 'lib/unitsml/transform.rb'
465
- - 'lib/unitsml/unit.rb'
466
- - 'lib/unitsml/utility.rb'
467
- - 'spec/unitsml/conv/asciimath_spec.rb'
468
- - 'spec/unitsml/conv/html_spec.rb'
469
- - 'spec/unitsml/conv/latex_spec.rb'
470
- - 'spec/unitsml/conv/plurimath_spec.rb'
471
- - 'spec/unitsml/parser_spec.rb'
472
-
473
- # Offense count: 154
474
- # This cop supports safe autocorrection (--autocorrect).
475
- # Configuration parameters: EnforcedStyleForMultiline.
476
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
477
- Style/TrailingCommaInArrayLiteral:
478
- Exclude:
479
- - 'lib/unitsml.rb'
480
- - 'lib/unitsml/formula.rb'
481
- - 'lib/unitsml/transform.rb'
482
- - 'spec/unitsml/conv/plurimath_spec.rb'
483
- - 'spec/unitsml/parser_spec.rb'
484
-
485
- # Offense count: 11
486
- # This cop supports safe autocorrection (--autocorrect).
487
- # Configuration parameters: EnforcedStyleForMultiline.
488
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
489
- Style/TrailingCommaInHashLiteral:
490
- Exclude:
491
- - 'lib/unitsml.rb'
492
- - 'lib/unitsml/dimension.rb'
493
- - 'lib/unitsml/extender.rb'
494
- - 'lib/unitsml/number.rb'
495
- - 'lib/unitsml/utility.rb'
data/Gemfile CHANGED
@@ -5,10 +5,9 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in unitsml.gemspec
6
6
  gemspec
7
7
 
8
- gem "lutaml-model", "~> 0.8.0", github: "lutaml/lutaml-model", branch: "main"
9
-
10
8
  gem "canon"
11
- gem "mml", github: "plurimath/mml", branch: "main"
9
+ gem "lutaml-model", "~> 0.8.0", github: "lutaml/lutaml-model", branch: "main"
10
+ gem "mml"
12
11
  gem "oga"
13
12
  gem "ox"
14
13
  gem "plurimath", github: "plurimath/plurimath", branch: "rt-lutaml-080"
@@ -16,5 +15,7 @@ gem "pry"
16
15
  gem "rake"
17
16
  gem "rspec"
18
17
  gem "rubocop"
18
+ gem "rubocop-performance"
19
+ gem "rubocop-rake"
20
+ gem "rubocop-rspec"
19
21
  gem "simplecov"
20
- gem "unitsdb", github: "unitsml/unitsdb-ruby", branch: "rt-lutaml-080-compat"
@@ -16,35 +16,37 @@ module Unitsml
16
16
  end
17
17
 
18
18
  def length=(value)
19
- quantities_common_code(:length, value)
19
+ quantities_common_code(:length, wrap_dimension_value(value))
20
20
  end
21
21
 
22
22
  def mass=(value)
23
- quantities_common_code(:mass, value)
23
+ quantities_common_code(:mass, wrap_dimension_value(value))
24
24
  end
25
25
 
26
26
  def time=(value)
27
- quantities_common_code(:time, value)
27
+ quantities_common_code(:time, wrap_dimension_value(value))
28
28
  end
29
29
 
30
30
  def thermodynamic_temperature=(value)
31
- quantities_common_code(:thermodynamic_temperature, value)
31
+ quantities_common_code(:thermodynamic_temperature,
32
+ wrap_dimension_value(value))
32
33
  end
33
34
 
34
35
  def amount_of_substance=(value)
35
- quantities_common_code(:amount_of_substance, value)
36
+ quantities_common_code(:amount_of_substance,
37
+ wrap_dimension_value(value))
36
38
  end
37
39
 
38
40
  def luminous_intensity=(value)
39
- quantities_common_code(:luminous_intensity, value)
41
+ quantities_common_code(:luminous_intensity, wrap_dimension_value(value))
40
42
  end
41
43
 
42
44
  def plane_angle=(value)
43
- quantities_common_code(:plane_angle, value)
45
+ quantities_common_code(:plane_angle, wrap_dimension_value(value))
44
46
  end
45
47
 
46
48
  def electric_current=(value)
47
- quantities_common_code(:electric_current, value)
49
+ quantities_common_code(:electric_current, wrap_dimension_value(value))
48
50
  end
49
51
 
50
52
  def dim_symbols
@@ -79,6 +81,14 @@ module Unitsml
79
81
  @parsable = true
80
82
  value.dim_symbols_ids(@parsables, id)
81
83
  end
84
+
85
+ def wrap_dimension_value(value)
86
+ return value if value.is_a?(DimensionQuantity)
87
+ return DimensionQuantity.new(value.to_hash) if value.is_a?(::Unitsdb::DimensionDetails)
88
+ return DimensionQuantity.new(value) if value.is_a?(Hash)
89
+
90
+ value
91
+ end
82
92
  end
83
93
  end
84
94
  end
@@ -16,7 +16,9 @@ module Unitsml
16
16
  end
17
17
 
18
18
  def prefix
19
- @prefix ||= Unitsdb.prefixes.find_by_id(id)
19
+ @prefix ||= ::Unitsdb.database.prefixes.find do |p|
20
+ p.identifiers.any? { |i| i.id == id }
21
+ end
20
22
  end
21
23
  end
22
24
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unitsml
4
+ module Unitsdb
5
+ class SiDerivedBase < ::Unitsdb::SiDerivedBase
6
+ def prefix_reference=(value)
7
+ return super if value.nil?
8
+ return super if value.is_a?(PrefixReference)
9
+
10
+ super(PrefixReference.new(value.to_hash))
11
+ end
12
+ end
13
+ end
14
+ end
@@ -3,9 +3,17 @@
3
3
  module Unitsml
4
4
  module Unitsdb
5
5
  class Unit < ::Unitsdb::Unit
6
+ def si_derived_bases=(value)
7
+ return super if value.nil?
8
+
9
+ super(value.map do |s|
10
+ SiDerivedBase.new(s.to_hash)
11
+ end)
12
+ end
13
+
6
14
  def dimension_url
7
15
  quantity_id = quantity_references[0].id
8
- quantity = Unitsdb.quantities.find_by_id(quantity_id)
16
+ quantity = Unitsml::Unitsdb.quantities.find_by_id(quantity_id)
9
17
  quantity.dimension_reference.id
10
18
  end
11
19
 
@@ -10,6 +10,7 @@ module Unitsml
10
10
  autoload :Quantities, "#{__dir__}/unitsdb/quantities"
11
11
  autoload :PrefixReference, "#{__dir__}/unitsdb/prefix_reference"
12
12
  autoload :DimensionQuantity, "#{__dir__}/unitsdb/dimension_quantity"
13
+ autoload :SiDerivedBase, "#{__dir__}/unitsdb/si_derived_base"
13
14
 
14
15
  class << self
15
16
  def units
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unitsml
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unitsml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -155,6 +155,7 @@ files:
155
155
  - lib/unitsml/unitsdb/prefix_reference.rb
156
156
  - lib/unitsml/unitsdb/prefixes.rb
157
157
  - lib/unitsml/unitsdb/quantities.rb
158
+ - lib/unitsml/unitsdb/si_derived_base.rb
158
159
  - lib/unitsml/unitsdb/unit.rb
159
160
  - lib/unitsml/unitsdb/units.rb
160
161
  - lib/unitsml/utility.rb