unitsml 0.5.1 → 0.6.0

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 (72) 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/.rubocop.yml +18 -0
  5. data/.rubocop_todo.yml +498 -0
  6. data/Gemfile +16 -11
  7. data/Rakefile +5 -3
  8. data/bin/console +4 -3
  9. data/docs/README.adoc +2 -2
  10. data/lib/unitsml/dimension.rb +49 -35
  11. data/lib/unitsml/errors/base_error.rb +8 -0
  12. data/lib/unitsml/errors/plurimath_load_error.rb +1 -1
  13. data/lib/unitsml/errors.rb +8 -0
  14. data/lib/unitsml/extender.rb +21 -16
  15. data/lib/unitsml/fenced.rb +30 -10
  16. data/lib/unitsml/fenced_numeric.rb +13 -0
  17. data/lib/unitsml/formula.rb +29 -29
  18. data/lib/unitsml/intermediate_exp_rules.rb +58 -17
  19. data/lib/unitsml/model/dimension.rb +4 -14
  20. data/lib/unitsml/model/dimension_quantities/quantity.rb +2 -0
  21. data/lib/unitsml/model/dimension_quantities.rb +17 -0
  22. data/lib/unitsml/model/prefix.rb +4 -8
  23. data/lib/unitsml/model/prefixes/name.rb +5 -4
  24. data/lib/unitsml/model/prefixes/symbol.rb +3 -2
  25. data/lib/unitsml/model/prefixes.rb +10 -0
  26. data/lib/unitsml/model/quantities/name.rb +4 -3
  27. data/lib/unitsml/model/quantities.rb +9 -0
  28. data/lib/unitsml/model/quantity.rb +5 -7
  29. data/lib/unitsml/model/unit.rb +4 -9
  30. data/lib/unitsml/model/units/enumerated_root_unit.rb +1 -0
  31. data/lib/unitsml/model/units/name.rb +4 -3
  32. data/lib/unitsml/model/units/root_units.rb +3 -2
  33. data/lib/unitsml/model/units/symbol.rb +2 -1
  34. data/lib/unitsml/model/units/system.rb +4 -3
  35. data/lib/unitsml/model/units.rb +13 -0
  36. data/lib/unitsml/model.rb +15 -0
  37. data/lib/unitsml/namespace.rb +8 -0
  38. data/lib/unitsml/number.rb +79 -0
  39. data/lib/unitsml/parse.rb +20 -19
  40. data/lib/unitsml/parser.rb +13 -14
  41. data/lib/unitsml/prefix.rb +10 -10
  42. data/lib/unitsml/sqrt.rb +3 -3
  43. data/lib/unitsml/transform.rb +133 -71
  44. data/lib/unitsml/unit.rb +41 -33
  45. data/lib/unitsml/unitsdb/dimension.rb +3 -3
  46. data/lib/unitsml/unitsdb/dimensions.rb +2 -4
  47. data/lib/unitsml/unitsdb/prefixes.rb +0 -2
  48. data/lib/unitsml/unitsdb/quantities.rb +0 -2
  49. data/lib/unitsml/unitsdb/unit.rb +2 -2
  50. data/lib/unitsml/unitsdb/units.rb +2 -4
  51. data/lib/unitsml/unitsdb.rb +14 -9
  52. data/lib/unitsml/utility.rb +111 -73
  53. data/lib/unitsml/version.rb +3 -1
  54. data/lib/unitsml.rb +51 -33
  55. data/unitsdb/Gemfile +6 -0
  56. data/unitsdb/README.adoc +193 -11
  57. data/unitsdb/dimensions.yaml +360 -8
  58. data/unitsdb/prefixes.yaml +104 -4
  59. data/unitsdb/quantities.yaml +602 -0
  60. data/unitsdb/schemas/dimensions-schema.yaml +2 -6
  61. data/unitsdb/schemas/prefixes-schema.yaml +2 -6
  62. data/unitsdb/schemas/quantities-schema.yaml +2 -5
  63. data/unitsdb/schemas/scales-schema.yaml +2 -5
  64. data/unitsdb/schemas/unit_systems-schema.yaml +2 -6
  65. data/unitsdb/schemas/units-schema.yaml +2 -6
  66. data/unitsdb/spec/units_spec.rb +3 -1
  67. data/unitsdb/unit_systems.yaml +4 -0
  68. data/unitsdb/units.yaml +957 -6
  69. data/unitsdb/validate_schemas.rb +32 -37
  70. data/unitsml.gemspec +3 -1
  71. metadata +29 -17
  72. data/lib/unitsml/error.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edaa6904f430d793ab777f84d10c89925006c07654d769932ac17eb34e826e93
4
- data.tar.gz: d5883a47de366c89c8e3d603aa9bfc99f307e94d73285bddcec426a34f6e963d
3
+ metadata.gz: b7484b38ea8a6aed7be580a14fc3b85852d29986957fa3d33951ae5e18e2ad6b
4
+ data.tar.gz: 422e09800989b3a9ac50177bd449e210f667451ba024e865884ab5926f917f99
5
5
  SHA512:
6
- metadata.gz: 46d962a6cb805be3f839125dc3bbab75913e0bac277800f808908f6de81d117c54fbd163418ef35b546834b8d0d9640290664d2ceb9658aea6638c6e86b29a5d
7
- data.tar.gz: 7d628fe1043c6dfc29b7e03844f1d2fbff50078afe344d0089682417dd441504aac9792dc6ff16cf7f340e4899e5d963375d341d7c553b0681e81d428022648b
6
+ metadata.gz: 8d56aa6d5bf8db31f70914adb64655601cf22c2de6886c36c67aa2eac423322f7116582451e588bf6018442b960147b8b3672377474fbf28d8e1d20237f9f437
7
+ data.tar.gz: b774ddedf3bd41a0b33596550d6cc9410519db3cbc8a23c525c34ae76968bce1b6666a00b4ad83cd6f6f03e5e49eca01948b4d9ac04929318cf65861e8a40ab8
@@ -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/.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,498 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2026-04-01 01:44:59 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: 3
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
12
+ Bundler/OrderedGems:
13
+ Exclude:
14
+ - 'Gemfile'
15
+
16
+ # Offense count: 3
17
+ # This cop supports safe autocorrection (--autocorrect).
18
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
19
+ Gemspec/OrderedDependencies:
20
+ Exclude:
21
+ - 'unitsml.gemspec'
22
+
23
+ # Offense count: 2
24
+ # This cop supports safe autocorrection (--autocorrect).
25
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
26
+ # SupportedStyles: with_first_argument, with_fixed_indentation
27
+ Layout/ArgumentAlignment:
28
+ Exclude:
29
+ - 'spec/unitsml/parser_spec.rb'
30
+ - 'unitsdb/validate_schemas.rb'
31
+
32
+ # Offense count: 59
33
+ # This cop supports safe autocorrection (--autocorrect).
34
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
35
+ # SupportedStyles: with_first_element, with_fixed_indentation
36
+ Layout/ArrayAlignment:
37
+ Exclude:
38
+ - 'spec/unitsml/conv/plurimath_spec.rb'
39
+ - 'spec/unitsml/parser_spec.rb'
40
+
41
+ # Offense count: 8
42
+ # This cop supports safe autocorrection (--autocorrect).
43
+ # Configuration parameters: EnforcedStyleAlignWith.
44
+ # SupportedStylesAlignWith: either, start_of_block, start_of_line
45
+ Layout/BlockAlignment:
46
+ Exclude:
47
+ - 'lib/unitsml/intermediate_exp_rules.rb'
48
+ - 'spec/unitsml/conv/latex_spec.rb'
49
+ - 'spec/unitsml/conv/plurimath_spec.rb'
50
+
51
+ # Offense count: 8
52
+ # This cop supports safe autocorrection (--autocorrect).
53
+ Layout/BlockEndNewline:
54
+ Exclude:
55
+ - 'lib/unitsml/intermediate_exp_rules.rb'
56
+ - 'spec/unitsml/conv/latex_spec.rb'
57
+ - 'spec/unitsml/conv/plurimath_spec.rb'
58
+
59
+ # Offense count: 1
60
+ # This cop supports safe autocorrection (--autocorrect).
61
+ Layout/ClosingParenthesisIndentation:
62
+ Exclude:
63
+ - 'spec/unitsml/conv/plurimath_spec.rb'
64
+
65
+ # Offense count: 2
66
+ # This cop supports safe autocorrection (--autocorrect).
67
+ Layout/ElseAlignment:
68
+ Exclude:
69
+ - 'lib/unitsml/number.rb'
70
+ - 'unitsdb/validate_schemas.rb'
71
+
72
+ # Offense count: 18
73
+ # This cop supports safe autocorrection (--autocorrect).
74
+ Layout/EmptyLineAfterMagicComment:
75
+ Enabled: false
76
+
77
+ # Offense count: 5
78
+ # This cop supports safe autocorrection (--autocorrect).
79
+ Layout/EmptyLines:
80
+ Exclude:
81
+ - 'lib/unitsml/model/dimension.rb'
82
+ - 'lib/unitsml/model/prefix.rb'
83
+ - 'lib/unitsml/model/quantity.rb'
84
+ - 'lib/unitsml/model/units/root_units.rb'
85
+
86
+ # Offense count: 10
87
+ # This cop supports safe autocorrection (--autocorrect).
88
+ # Configuration parameters: EnforcedStyle.
89
+ # SupportedStyles: empty_lines, no_empty_lines
90
+ Layout/EmptyLinesAroundBlockBody:
91
+ Exclude:
92
+ - 'spec/unitsml/conv/asciimath_spec.rb'
93
+ - 'spec/unitsml/conv/html_spec.rb'
94
+ - 'spec/unitsml/conv/latex_spec.rb'
95
+ - 'spec/unitsml/conv/mathml_spec.rb'
96
+ - 'spec/unitsml/conv/plurimath_spec.rb'
97
+ - 'spec/unitsml/conv/unicode_spec.rb'
98
+ - 'spec/unitsml/conv/xml_spec.rb'
99
+ - 'spec/unitsml/parse_spec.rb'
100
+ - 'spec/unitsml/parser_spec.rb'
101
+
102
+ # Offense count: 1
103
+ # This cop supports safe autocorrection (--autocorrect).
104
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
105
+ Exclude:
106
+ - 'unitsdb/validate_schemas.rb'
107
+
108
+ # Offense count: 2
109
+ # This cop supports safe autocorrection (--autocorrect).
110
+ Layout/EmptyLinesAroundMethodBody:
111
+ Exclude:
112
+ - 'unitsdb/validate_schemas.rb'
113
+
114
+ # Offense count: 82
115
+ # This cop supports safe autocorrection (--autocorrect).
116
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
117
+ # SupportedStyles: special_inside_parentheses, consistent, align_brackets
118
+ Layout/FirstArrayElementIndentation:
119
+ Exclude:
120
+ - 'spec/unitsml/conv/plurimath_spec.rb'
121
+ - 'spec/unitsml/parser_spec.rb'
122
+
123
+ # Offense count: 1
124
+ # This cop supports safe autocorrection (--autocorrect).
125
+ Layout/HeredocIndentation:
126
+ Exclude:
127
+ - 'spec/unitsml/conv/xml_spec.rb'
128
+
129
+ # Offense count: 2
130
+ # This cop supports safe autocorrection (--autocorrect).
131
+ # Configuration parameters: EnforcedStyle.
132
+ # SupportedStyles: normal, indented_internal_methods
133
+ Layout/IndentationConsistency:
134
+ Exclude:
135
+ - 'unitsdb/validate_schemas.rb'
136
+
137
+ # Offense count: 20
138
+ # This cop supports safe autocorrection (--autocorrect).
139
+ # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
140
+ # SupportedStylesAlignWith: start_of_line, relative_to_receiver
141
+ Layout/IndentationWidth:
142
+ Exclude:
143
+ - 'lib/unitsml/intermediate_exp_rules.rb'
144
+ - 'lib/unitsml/number.rb'
145
+ - 'spec/unitsml/conv/latex_spec.rb'
146
+ - 'spec/unitsml/conv/plurimath_spec.rb'
147
+ - 'unitsdb/validate_schemas.rb'
148
+
149
+ # Offense count: 1
150
+ # This cop supports safe autocorrection (--autocorrect).
151
+ # Configuration parameters: EnforcedStyle.
152
+ # SupportedStyles: symmetrical, new_line, same_line
153
+ Layout/MultilineArrayBraceLayout:
154
+ Exclude:
155
+ - 'lib/unitsml/transform.rb'
156
+
157
+ # Offense count: 1
158
+ # This cop supports safe autocorrection (--autocorrect).
159
+ Layout/RescueEnsureAlignment:
160
+ Exclude:
161
+ - 'unitsdb/validate_schemas.rb'
162
+
163
+ # Offense count: 1
164
+ # This cop supports safe autocorrection (--autocorrect).
165
+ Layout/SpaceAfterComma:
166
+ Exclude:
167
+ - 'lib/unitsml/unitsdb.rb'
168
+
169
+ # Offense count: 1
170
+ # This cop supports safe autocorrection (--autocorrect).
171
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
172
+ # SupportedStyles: space, no_space
173
+ # SupportedStylesForEmptyBraces: space, no_space
174
+ Layout/SpaceBeforeBlockBraces:
175
+ Exclude:
176
+ - 'spec/unitsml/parse_spec.rb'
177
+
178
+ # Offense count: 4
179
+ # This cop supports safe autocorrection (--autocorrect).
180
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
181
+ # SupportedStyles: space, no_space
182
+ # SupportedStylesForEmptyBraces: space, no_space
183
+ Layout/SpaceInsideBlockBraces:
184
+ Exclude:
185
+ - 'lib/unitsml/parse.rb'
186
+ - 'spec/unitsml/parse_spec.rb'
187
+
188
+ # Offense count: 1
189
+ # This cop supports safe autocorrection (--autocorrect).
190
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
191
+ # SupportedStyles: space, no_space, compact
192
+ # SupportedStylesForEmptyBraces: space, no_space
193
+ Layout/SpaceInsideHashLiteralBraces:
194
+ Exclude:
195
+ - 'lib/unitsml/prefix.rb'
196
+
197
+ # Offense count: 5
198
+ # This cop supports safe autocorrection (--autocorrect).
199
+ # Configuration parameters: EnforcedStyle.
200
+ # SupportedStyles: final_newline, final_blank_line
201
+ Layout/TrailingEmptyLines:
202
+ Exclude:
203
+ - 'lib/unitsml.rb'
204
+ - 'lib/unitsml/unitsdb/dimensions.rb'
205
+ - 'lib/unitsml/unitsdb/prefixes.rb'
206
+ - 'lib/unitsml/unitsdb/quantities.rb'
207
+ - 'lib/unitsml/unitsdb/units.rb'
208
+
209
+ # Offense count: 2
210
+ # This cop supports safe autocorrection (--autocorrect).
211
+ # Configuration parameters: AllowInHeredoc.
212
+ Layout/TrailingWhitespace:
213
+ Exclude:
214
+ - 'unitsdb/validate_schemas.rb'
215
+
216
+ # Offense count: 1
217
+ # This cop supports safe autocorrection (--autocorrect).
218
+ # Configuration parameters: AllowedMethods.
219
+ # AllowedMethods: present?, blank?, presence, try, try!, in?
220
+ Lint/SafeNavigationChain:
221
+ Exclude:
222
+ - 'lib/unitsml/parse.rb'
223
+
224
+ # Offense count: 16
225
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
226
+ Metrics/AbcSize:
227
+ Max: 51
228
+
229
+ # Offense count: 89
230
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
231
+ # AllowedMethods: refine
232
+ Metrics/BlockLength:
233
+ Max: 1251
234
+
235
+ # Offense count: 5
236
+ # Configuration parameters: CountComments, CountAsOne.
237
+ Metrics/ClassLength:
238
+ Max: 252
239
+
240
+ # Offense count: 11
241
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
242
+ Metrics/CyclomaticComplexity:
243
+ Max: 14
244
+
245
+ # Offense count: 17
246
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
247
+ Metrics/MethodLength:
248
+ Max: 47
249
+
250
+ # Offense count: 1
251
+ # Configuration parameters: CountComments, CountAsOne.
252
+ Metrics/ModuleLength:
253
+ Max: 290
254
+
255
+ # Offense count: 1
256
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
257
+ Metrics/ParameterLists:
258
+ Max: 6
259
+
260
+ # Offense count: 10
261
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
262
+ Metrics/PerceivedComplexity:
263
+ Max: 14
264
+
265
+ # Offense count: 1
266
+ Naming/AccessorMethodName:
267
+ Exclude:
268
+ - 'lib/unitsml/utility.rb'
269
+
270
+ # Offense count: 7
271
+ # This cop supports safe autocorrection (--autocorrect).
272
+ Naming/BinaryOperatorParameterName:
273
+ Exclude:
274
+ - 'lib/unitsml/dimension.rb'
275
+ - 'lib/unitsml/extender.rb'
276
+ - 'lib/unitsml/fenced.rb'
277
+ - 'lib/unitsml/number.rb'
278
+ - 'lib/unitsml/prefix.rb'
279
+ - 'lib/unitsml/sqrt.rb'
280
+ - 'lib/unitsml/unit.rb'
281
+
282
+ # Offense count: 2
283
+ # This cop supports unsafe autocorrection (--autocorrect-all).
284
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
285
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
286
+ Naming/MemoizedInstanceVariableName:
287
+ Exclude:
288
+ - 'lib/unitsml/unitsdb/dimension.rb'
289
+ - 'lib/unitsml/unitsdb/units.rb'
290
+
291
+ # Offense count: 3
292
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
293
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
294
+ Naming/MethodParameterName:
295
+ Exclude:
296
+ - 'lib/unitsml/utility.rb'
297
+
298
+ # Offense count: 14
299
+ # This cop supports safe autocorrection (--autocorrect).
300
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
301
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
302
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
303
+ # FunctionalMethods: let, let!, subject, watch
304
+ # AllowedMethods: lambda, proc, it
305
+ Style/BlockDelimiters:
306
+ Exclude:
307
+ - 'lib/unitsml/intermediate_exp_rules.rb'
308
+ - 'spec/unitsml/conv/latex_spec.rb'
309
+ - 'spec/unitsml/conv/plurimath_spec.rb'
310
+
311
+ # Offense count: 11
312
+ Style/ClassVars:
313
+ Exclude:
314
+ - 'lib/unitsml/parse.rb'
315
+ - 'lib/unitsml/unitsdb.rb'
316
+
317
+ # Offense count: 1
318
+ # This cop supports safe autocorrection (--autocorrect).
319
+ # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
320
+ # SupportedStyles: assign_to_condition, assign_inside_condition
321
+ Style/ConditionalAssignment:
322
+ Exclude:
323
+ - 'lib/unitsml/number.rb'
324
+
325
+ # Offense count: 46
326
+ # Configuration parameters: AllowedConstants.
327
+ Style/Documentation:
328
+ Enabled: false
329
+
330
+ # Offense count: 20
331
+ # This cop supports unsafe autocorrection (--autocorrect-all).
332
+ # Configuration parameters: EnforcedStyle.
333
+ # SupportedStyles: always, always_true, never
334
+ Style/FrozenStringLiteralComment:
335
+ Enabled: false
336
+
337
+ # Offense count: 1
338
+ # This cop supports safe autocorrection (--autocorrect).
339
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
340
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
341
+ # SupportedShorthandSyntax: always, never, either, consistent, either_consistent
342
+ Style/HashSyntax:
343
+ Exclude:
344
+ - 'Rakefile'
345
+
346
+ # Offense count: 1
347
+ # This cop supports safe autocorrection (--autocorrect).
348
+ # Configuration parameters: AllowIfModifier.
349
+ Style/IfInsideElse:
350
+ Exclude:
351
+ - 'unitsdb/validate_schemas.rb'
352
+
353
+ # Offense count: 3
354
+ # This cop supports safe autocorrection (--autocorrect).
355
+ Style/IfUnlessModifier:
356
+ Exclude:
357
+ - 'lib/unitsml/unit.rb'
358
+ - 'unitsdb/validate_schemas.rb'
359
+
360
+ # Offense count: 1
361
+ # This cop supports unsafe autocorrection (--autocorrect-all).
362
+ # Configuration parameters: EnforcedStyle, Autocorrect.
363
+ # SupportedStyles: module_function, extend_self, forbidden
364
+ Style/ModuleFunction:
365
+ Exclude:
366
+ - 'lib/unitsml.rb'
367
+
368
+ # Offense count: 1
369
+ Style/MultilineBlockChain:
370
+ Exclude:
371
+ - 'lib/unitsml/utility.rb'
372
+
373
+ # Offense count: 1
374
+ # This cop supports unsafe autocorrection (--autocorrect-all).
375
+ # Configuration parameters: EnforcedStyle.
376
+ # SupportedStyles: literals, strict
377
+ Style/MutableConstant:
378
+ Exclude:
379
+ - 'lib/unitsml/version.rb'
380
+
381
+ # Offense count: 2
382
+ # Configuration parameters: AllowedMethods.
383
+ # AllowedMethods: respond_to_missing?
384
+ Style/OptionalBooleanParameter:
385
+ Exclude:
386
+ - 'lib/unitsml/parser.rb'
387
+ - 'lib/unitsml/prefix.rb'
388
+
389
+ # Offense count: 1
390
+ # This cop supports safe autocorrection (--autocorrect).
391
+ Style/RedundantBegin:
392
+ Exclude:
393
+ - 'unitsdb/validate_schemas.rb'
394
+
395
+ # Offense count: 1
396
+ # This cop supports safe autocorrection (--autocorrect).
397
+ Style/RedundantFreeze:
398
+ Exclude:
399
+ - 'lib/unitsml/version.rb'
400
+
401
+ # Offense count: 2
402
+ # This cop supports safe autocorrection (--autocorrect).
403
+ Style/RedundantParentheses:
404
+ Exclude:
405
+ - 'lib/unitsml/unitsdb/units.rb'
406
+
407
+ # Offense count: 2
408
+ # This cop supports safe autocorrection (--autocorrect).
409
+ # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
410
+ # SupportedStyles: slashes, percent_r, mixed
411
+ Style/RegexpLiteral:
412
+ Exclude:
413
+ - 'lib/unitsml/parser.rb'
414
+ - 'lib/unitsml/unitsdb/units.rb'
415
+
416
+ # Offense count: 1
417
+ # This cop supports unsafe autocorrection (--autocorrect-all).
418
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
419
+ # AllowedMethods: present?, blank?, presence, try, try!
420
+ Style/SafeNavigation:
421
+ Exclude:
422
+ - 'lib/unitsml/prefix.rb'
423
+
424
+ # Offense count: 2
425
+ # This cop supports unsafe autocorrection (--autocorrect-all).
426
+ # Configuration parameters: RequireEnglish, EnforcedStyle.
427
+ # SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
428
+ Style/SpecialGlobalVars:
429
+ Exclude:
430
+ - 'unitsdb/validate_schemas.rb'
431
+
432
+ # Offense count: 2
433
+ # This cop supports unsafe autocorrection (--autocorrect-all).
434
+ # Configuration parameters: Mode.
435
+ Style/StringConcatenation:
436
+ Exclude:
437
+ - 'lib/unitsml/utility.rb'
438
+ - 'unitsdb/validate_schemas.rb'
439
+
440
+ # Offense count: 2046
441
+ # This cop supports safe autocorrection (--autocorrect).
442
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
443
+ # SupportedStyles: single_quotes, double_quotes
444
+ Style/StringLiterals:
445
+ Enabled: false
446
+
447
+ # Offense count: 1
448
+ # This cop supports safe autocorrection (--autocorrect).
449
+ # Configuration parameters: EnforcedStyle.
450
+ # SupportedStyles: single_quotes, double_quotes
451
+ Style/StringLiteralsInInterpolation:
452
+ Exclude:
453
+ - 'unitsdb/validate_schemas.rb'
454
+
455
+ # Offense count: 235
456
+ # This cop supports safe autocorrection (--autocorrect).
457
+ # Configuration parameters: EnforcedStyleForMultiline.
458
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
459
+ Style/TrailingCommaInArguments:
460
+ Exclude:
461
+ - 'lib/unitsml.rb'
462
+ - 'lib/unitsml/dimension.rb'
463
+ - 'lib/unitsml/number.rb'
464
+ - 'lib/unitsml/parser.rb'
465
+ - 'lib/unitsml/prefix.rb'
466
+ - 'lib/unitsml/transform.rb'
467
+ - 'lib/unitsml/unit.rb'
468
+ - 'spec/unitsml/conv/plurimath_spec.rb'
469
+ - 'spec/unitsml/parser_spec.rb'
470
+
471
+ # Offense count: 132
472
+ # This cop supports safe autocorrection (--autocorrect).
473
+ # Configuration parameters: EnforcedStyleForMultiline.
474
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
475
+ Style/TrailingCommaInArrayLiteral:
476
+ Exclude:
477
+ - 'lib/unitsml.rb'
478
+ - 'lib/unitsml/transform.rb'
479
+ - 'spec/unitsml/conv/plurimath_spec.rb'
480
+ - 'spec/unitsml/parser_spec.rb'
481
+
482
+ # Offense count: 5
483
+ # This cop supports safe autocorrection (--autocorrect).
484
+ # Configuration parameters: EnforcedStyleForMultiline.
485
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
486
+ Style/TrailingCommaInHashLiteral:
487
+ Exclude:
488
+ - 'lib/unitsml.rb'
489
+ - 'lib/unitsml/dimension.rb'
490
+ - 'lib/unitsml/extender.rb'
491
+ - 'lib/unitsml/number.rb'
492
+
493
+ # Offense count: 17
494
+ # This cop supports safe autocorrection (--autocorrect).
495
+ # Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
496
+ # URISchemes: http, https
497
+ Layout/LineLength:
498
+ Max: 215
data/Gemfile CHANGED
@@ -1,15 +1,20 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
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 "oga"
9
- gem "ox"
10
- gem "plurimath"
11
- gem "pry"
12
- gem "rake"
13
- gem "rspec"
14
- gem "rubocop"
15
- gem "simplecov"
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'
12
+ gem 'oga'
13
+ gem 'ox'
14
+ gem 'unitsdb', github: 'unitsml/unitsdb-ruby', branch: 'main'
15
+ gem 'plurimath', github: 'plurimath/plurimath', branch: 'rt-lutaml-080'
16
+ gem 'pry'
17
+ gem 'rake'
18
+ gem 'rspec'
19
+ gem 'rubocop'
20
+ gem 'simplecov'
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
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,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "unitsml"
4
+ require 'bundler/setup'
5
+ require 'unitsml'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "unitsml"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
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">