unitsml 0.5.1 → 0.6.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/rake.yml +8 -0
  3. data/.github/workflows/release.yml +7 -1
  4. data/.gitmodules +0 -3
  5. data/.rubocop.yml +18 -0
  6. data/.rubocop_todo.yml +495 -0
  7. data/Gemfile +8 -3
  8. data/Rakefile +3 -1
  9. data/bin/console +1 -0
  10. data/docs/README.adoc +2 -2
  11. data/lib/unitsml/dimension.rb +48 -34
  12. data/lib/unitsml/errors/base_error.rb +8 -0
  13. data/lib/unitsml/errors/plurimath_load_error.rb +1 -1
  14. data/lib/unitsml/errors.rb +8 -0
  15. data/lib/unitsml/extender.rb +16 -11
  16. data/lib/unitsml/fenced.rb +28 -8
  17. data/lib/unitsml/fenced_numeric.rb +13 -0
  18. data/lib/unitsml/formula.rb +35 -26
  19. data/lib/unitsml/intermediate_exp_rules.rb +68 -17
  20. data/lib/unitsml/model/dimension.rb +4 -14
  21. data/lib/unitsml/model/dimension_quantities/quantity.rb +2 -0
  22. data/lib/unitsml/model/dimension_quantities.rb +21 -0
  23. data/lib/unitsml/model/prefix.rb +4 -8
  24. data/lib/unitsml/model/prefixes/name.rb +5 -4
  25. data/lib/unitsml/model/prefixes/symbol.rb +3 -2
  26. data/lib/unitsml/model/prefixes.rb +10 -0
  27. data/lib/unitsml/model/quantities/name.rb +4 -3
  28. data/lib/unitsml/model/quantities.rb +9 -0
  29. data/lib/unitsml/model/quantity.rb +4 -6
  30. data/lib/unitsml/model/unit.rb +4 -9
  31. data/lib/unitsml/model/units/enumerated_root_unit.rb +1 -0
  32. data/lib/unitsml/model/units/name.rb +4 -3
  33. data/lib/unitsml/model/units/root_units.rb +3 -2
  34. data/lib/unitsml/model/units/symbol.rb +5 -2
  35. data/lib/unitsml/model/units/system.rb +4 -3
  36. data/lib/unitsml/model/units.rb +13 -0
  37. data/lib/unitsml/model.rb +15 -0
  38. data/lib/unitsml/namespace.rb +8 -0
  39. data/lib/unitsml/number.rb +79 -0
  40. data/lib/unitsml/parse.rb +31 -19
  41. data/lib/unitsml/parser.rb +5 -6
  42. data/lib/unitsml/prefix.rb +11 -9
  43. data/lib/unitsml/sqrt.rb +3 -3
  44. data/lib/unitsml/transform.rb +117 -55
  45. data/lib/unitsml/unit.rb +43 -33
  46. data/lib/unitsml/unitsdb/dimension.rb +5 -3
  47. data/lib/unitsml/unitsdb/dimensions.rb +6 -4
  48. data/lib/unitsml/unitsdb/prefixes.rb +0 -2
  49. data/lib/unitsml/unitsdb/quantities.rb +0 -2
  50. data/lib/unitsml/unitsdb/units.rb +6 -4
  51. data/lib/unitsml/unitsdb.rb +17 -23
  52. data/lib/unitsml/utility.rb +91 -42
  53. data/lib/unitsml/version.rb +3 -1
  54. data/lib/unitsml.rb +56 -38
  55. data/unitsml.gemspec +24 -19
  56. metadata +29 -35
  57. data/lib/unitsml/error.rb +0 -8
  58. data/unitsdb/LICENSE.md +0 -53
  59. data/unitsdb/README.adoc +0 -1071
  60. data/unitsdb/RELEASE-NOTES.adoc +0 -269
  61. data/unitsdb/dimensions.yaml +0 -1512
  62. data/unitsdb/prefixes.yaml +0 -774
  63. data/unitsdb/quantities.yaml +0 -3113
  64. data/unitsdb/scales.yaml +0 -97
  65. data/unitsdb/schemas/README.md +0 -159
  66. data/unitsdb/schemas/dimensions-schema.yaml +0 -157
  67. data/unitsdb/schemas/prefixes-schema.yaml +0 -159
  68. data/unitsdb/schemas/quantities-schema.yaml +0 -120
  69. data/unitsdb/schemas/scales-schema.yaml +0 -109
  70. data/unitsdb/schemas/unit_systems-schema.yaml +0 -120
  71. data/unitsdb/schemas/units-schema.yaml +0 -219
  72. data/unitsdb/spec/units_spec.rb +0 -20
  73. data/unitsdb/unit_systems.yaml +0 -74
  74. data/unitsdb/units.yaml +0 -13101
  75. data/unitsdb/validate_schemas.rb +0 -208
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edaa6904f430d793ab777f84d10c89925006c07654d769932ac17eb34e826e93
4
- data.tar.gz: d5883a47de366c89c8e3d603aa9bfc99f307e94d73285bddcec426a34f6e963d
3
+ metadata.gz: cc95997f58b3e086c0ef26a0a030d5f7158aac7f2456cf879d33078c40b2dcaf
4
+ data.tar.gz: 9a687fa649e8f8ebcf0f42ed0cd29440f69ad64d1799ded6f4267ec2e36c9c96
5
5
  SHA512:
6
- metadata.gz: 46d962a6cb805be3f839125dc3bbab75913e0bac277800f808908f6de81d117c54fbd163418ef35b546834b8d0d9640290664d2ceb9658aea6638c6e86b29a5d
7
- data.tar.gz: 7d628fe1043c6dfc29b7e03844f1d2fbff50078afe344d0089682417dd441504aac9792dc6ff16cf7f340e4899e5d963375d341d7c553b0681e81d428022648b
6
+ metadata.gz: 10c82e86eef30472bda3d6e956f00627b523aada12f8dcd58499d7422c0c00e0a36b8c0a047f7093f47a294131425d3fb29699dbe25c345a7ea5f660deb0fb8d
7
+ data.tar.gz: 29e5414746513fa0c13e459f4bf72c97b8e4e3246191f6650646443f1a10477929b9733d80d976ff866e58afe40033e4c1087254ba43a0b4a41ae55042bb63fc
@@ -9,3 +9,11 @@ on:
9
9
  jobs:
10
10
  rake:
11
11
  uses: metanorma/ci/.github/workflows/generic-rake.yml@main
12
+ with:
13
+ before-setup-ruby: |
14
+ mkdir -p .bundle
15
+ touch .bundle/config
16
+ cat .bundle/config
17
+ echo "---" >> .bundle/config
18
+ echo 'BUNDLE_BUILD__RUBY___LL: "--with-cflags=-std=gnu17"' >> .bundle/config
19
+ cat .bundle/config
@@ -1,11 +1,17 @@
1
1
  name: release
2
2
 
3
+ permissions:
4
+ contents: write
5
+ packages: write
6
+ id-token: write
7
+
3
8
  on:
4
9
  workflow_dispatch:
5
10
  inputs:
6
11
  next_version:
7
12
  description: |
8
- Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
13
+ Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
14
+ Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
9
15
  required: true
10
16
  default: 'skip'
11
17
  repository_dispatch:
data/.gitmodules CHANGED
@@ -1,6 +1,3 @@
1
- [submodule "unitsdb"]
2
- path = unitsdb
3
- url = https://github.com/unitsml/unitsdb.git
4
1
  [submodule "vendor/unitsdb"]
5
2
  path = vendor/unitsdb
6
3
  url = https://github.com/unitsml/unitsdb.git
data/.rubocop.yml ADDED
@@ -0,0 +1,18 @@
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
3
+ - .rubocop_todo.yml
4
+
5
+ inherit_mode:
6
+ merge:
7
+ - Exclude
8
+
9
+ plugins:
10
+ - rubocop-rspec
11
+ - rubocop-performance
12
+ - rubocop-rake
13
+
14
+ AllCops:
15
+ TargetRubyVersion: 3.0
16
+ Exclude:
17
+ - 'unitsdb/**/*'
18
+ - 'vendor/**/*'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,495 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2026-04-03 23:07:18 UTC using RuboCop version 1.86.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 6
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
12
+ Bundler/OrderedGems:
13
+ Exclude:
14
+ - 'Gemfile'
15
+
16
+ # Offense count: 1
17
+ # This cop supports safe autocorrection (--autocorrect).
18
+ Gemspec/RequireMFA:
19
+ Exclude:
20
+ - 'unitsml.gemspec'
21
+
22
+ # Offense count: 1
23
+ Gemspec/RequiredRubyVersion:
24
+ Exclude:
25
+ - 'unitsml.gemspec'
26
+
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
155
+ # This cop supports safe autocorrection (--autocorrect).
156
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
157
+ # URISchemes: http, https
158
+ 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
+ Exclude:
183
+ - 'lib/unitsml/formula.rb'
184
+ - 'lib/unitsml/model/dimension_quantities.rb'
185
+ - 'lib/unitsml/model/units/symbol.rb'
186
+ - 'lib/unitsml/parse.rb'
187
+ - 'lib/unitsml/unit.rb'
188
+ - 'lib/unitsml/utility.rb'
189
+ - 'spec/unitsml/conv/mathml_spec.rb'
190
+ - 'spec/unitsml/conv/plurimath_spec.rb'
191
+
192
+ # Offense count: 21
193
+ # This cop supports safe autocorrection (--autocorrect).
194
+ Lint/AmbiguousOperatorPrecedence:
195
+ Exclude:
196
+ - 'lib/unitsml/intermediate_exp_rules.rb'
197
+ - 'lib/unitsml/parse.rb'
198
+ - 'lib/unitsml/utility.rb'
199
+
200
+ # Offense count: 19
201
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
202
+ Metrics/AbcSize:
203
+ Exclude:
204
+ - 'lib/unitsml/fenced.rb'
205
+ - 'lib/unitsml/formula.rb'
206
+ - 'lib/unitsml/parse.rb'
207
+ - 'lib/unitsml/parser.rb'
208
+ - 'lib/unitsml/unit.rb'
209
+ - 'lib/unitsml/utility.rb'
210
+
211
+ # Offense count: 13
212
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
213
+ Metrics/CyclomaticComplexity:
214
+ Exclude:
215
+ - 'lib/unitsml/formula.rb'
216
+ - 'lib/unitsml/parse.rb'
217
+ - 'lib/unitsml/parser.rb'
218
+ - 'lib/unitsml/utility.rb'
219
+
220
+ # Offense count: 14
221
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
222
+ Metrics/MethodLength:
223
+ Max: 20
224
+
225
+ # Offense count: 1
226
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
227
+ Metrics/ParameterLists:
228
+ Max: 6
229
+
230
+ # Offense count: 9
231
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
232
+ Metrics/PerceivedComplexity:
233
+ Exclude:
234
+ - 'lib/unitsml/formula.rb'
235
+ - 'lib/unitsml/parse.rb'
236
+ - 'lib/unitsml/parser.rb'
237
+ - 'lib/unitsml/utility.rb'
238
+
239
+ # Offense count: 3
240
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
241
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
242
+ Naming/MethodParameterName:
243
+ Exclude:
244
+ - 'lib/unitsml/utility.rb'
245
+
246
+ # Offense count: 1
247
+ # Configuration parameters: MinSize.
248
+ Performance/CollectionLiteralInLoop:
249
+ Exclude:
250
+ - 'lib/unitsml/parser.rb'
251
+
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
+ # Offense count: 1
271
+ RSpec/AnyInstance:
272
+ Exclude:
273
+ - 'spec/unitsml/conv/plurimath_spec.rb'
274
+
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
+ # Offense count: 2
284
+ RSpec/BeforeAfterAll:
285
+ Exclude:
286
+ - 'spec/unitsml/conv/mathml_spec.rb'
287
+ - 'spec/unitsml/conv/xml_spec.rb'
288
+
289
+ # Offense count: 366
290
+ # Configuration parameters: Prefixes, AllowedPatterns.
291
+ # Prefixes: when, with, without
292
+ RSpec/ContextWording:
293
+ Exclude:
294
+ - 'spec/unitsml/conv/asciimath_spec.rb'
295
+ - 'spec/unitsml/conv/html_spec.rb'
296
+ - 'spec/unitsml/conv/latex_spec.rb'
297
+ - 'spec/unitsml/conv/mathml_spec.rb'
298
+ - 'spec/unitsml/conv/plurimath_spec.rb'
299
+ - 'spec/unitsml/conv/unicode_spec.rb'
300
+ - 'spec/unitsml/conv/xml_spec.rb'
301
+ - 'spec/unitsml/parse_spec.rb'
302
+ - 'spec/unitsml/parser_spec.rb'
303
+
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
+ # Offense count: 5
318
+ # Configuration parameters: CountAsOne.
319
+ RSpec/ExampleLength:
320
+ Max: 7
321
+
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
+ # Offense count: 15
330
+ RSpec/MultipleExpectations:
331
+ Max: 6
332
+
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
+ # Offense count: 12
340
+ RSpec/RepeatedExampleGroupBody:
341
+ Exclude:
342
+ - 'spec/unitsml/conv/asciimath_spec.rb'
343
+ - 'spec/unitsml/conv/unicode_spec.rb'
344
+ - 'spec/unitsml/conv/xml_spec.rb'
345
+ - 'spec/unitsml/parse_spec.rb'
346
+
347
+ # Offense count: 4
348
+ RSpec/RepeatedExampleGroupDescription:
349
+ Exclude:
350
+ - 'spec/unitsml/conv/mathml_spec.rb'
351
+ - 'spec/unitsml/parse_spec.rb'
352
+
353
+ # Offense count: 7
354
+ # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
355
+ # SupportedInflectors: default, active_support
356
+ RSpec/SpecFilePathFormat:
357
+ Exclude:
358
+ - 'spec/unitsml/conv/asciimath_spec.rb'
359
+ - 'spec/unitsml/conv/html_spec.rb'
360
+ - 'spec/unitsml/conv/latex_spec.rb'
361
+ - 'spec/unitsml/conv/mathml_spec.rb'
362
+ - 'spec/unitsml/conv/plurimath_spec.rb'
363
+ - 'spec/unitsml/conv/unicode_spec.rb'
364
+ - 'spec/unitsml/conv/xml_spec.rb'
365
+
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
+ # Offense count: 2
400
+ # Configuration parameters: AllowedMethods.
401
+ # AllowedMethods: respond_to_missing?
402
+ Style/OptionalBooleanParameter:
403
+ Exclude:
404
+ - 'lib/unitsml/parser.rb'
405
+ - 'lib/unitsml/prefix.rb'
406
+
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
+ # Offense count: 2
433
+ # Configuration parameters: Max.
434
+ Style/SafeNavigationChainLength:
435
+ Exclude:
436
+ - 'lib/unitsml/dimension.rb'
437
+ - 'lib/unitsml/parse.rb'
438
+
439
+ # Offense count: 1
440
+ # This cop supports unsafe autocorrection (--autocorrect-all).
441
+ # Configuration parameters: Mode.
442
+ Style/StringConcatenation:
443
+ Exclude:
444
+ - '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
@@ -1,15 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in unitsml.gemspec
4
6
  gemspec
5
7
 
6
- gem "byebug"
7
- gem "equivalent-xml"
8
+ gem "lutaml-model", "~> 0.8.0", github: "lutaml/lutaml-model", branch: "main"
9
+
10
+ gem "canon"
11
+ gem "mml", github: "plurimath/mml", branch: "main"
8
12
  gem "oga"
9
13
  gem "ox"
10
- gem "plurimath"
14
+ gem "plurimath", github: "plurimath/plurimath", branch: "rt-lutaml-080"
11
15
  gem "pry"
12
16
  gem "rake"
13
17
  gem "rspec"
14
18
  gem "rubocop"
15
19
  gem "simplecov"
20
+ gem "unitsdb", github: "unitsml/unitsdb-ruby", branch: "rt-lutaml-080-compat"
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rspec/core/rake_task"
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "unitsml"
data/docs/README.adoc CHANGED
@@ -69,7 +69,7 @@ unit.to_s # => "m"
69
69
  unit.to_xml
70
70
  # =>
71
71
  <Unit xmlns="https://schema.unitsml.org/unitsml/1.0" xml:id="U_NISTu1" dimensionURL="#NISTd1">
72
- <UnitSystem name="SI" type="SI_derived" xml:lang="en-US"/>
72
+ <UnitSystem name="SI" type="SI_derived" xml:lang="en"/>
73
73
  <UnitName xml:lang="en">meter</UnitName>
74
74
  <UnitSymbol type="HTML">m</UnitSymbol>
75
75
  <UnitSymbol type="MathMl">
@@ -102,7 +102,7 @@ unit.to_s # => "um"
102
102
  unit.to_xml
103
103
  # =>
104
104
  <Unit xmlns="https://schema.unitsml.org/unitsml/1.0" xml:id="U_um" dimensionURL="#NISTd1">
105
- <UnitSystem name="SI" type="SI_derived" xml:lang="en-US"/>
105
+ <UnitSystem name="SI" type="SI_derived" xml:lang="en"/>
106
106
  <UnitName xml:lang="en">um</UnitName>
107
107
  <UnitSymbol type="HTML">&micro;m</UnitSymbol>
108
108
  <UnitSymbol type="MathMl"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">