-
Notifications
You must be signed in to change notification settings - Fork 1
Update UnitsML for latest MathML, Plurimath, and UnitsDB integration changes #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
59b8b02
feat: use lutaml register for MathML v4 model resolution
e29bd4d
Update UnitsML to support latest MML, Plurimath, and UnitsDB changes
06238d0
feat: use Unitsdb::Configuration for context and type substitution ma…
5f59792
added unitsdb-ruby branch name
5aa5c95
feat: improve UnitsDB loading and add Opal payload error coverage
60cb956
refactor: fixed failing specs and Gemfile
b160141
refactor: rubocop fixes
6b205b5
Merge remote-tracking branch 'origin/main' into feat/mml-v4-register
5260d43
feat: lazy load unitsdb and handle opal payloads
ba623e1
fix: load UnitsDB with context fallback and clean up MathML handling
12cee6c
Fix MathML v4 content handling with released mml
43a4890
Fix UnitsDB compatibility and MathML helper regressions
91ee2c0
Make MathML helper spec tolerate collection-backed content
03953e1
fixed rubocop warning
98ab447
Remove redundant Opal branch from UnitsML UnitsDB loader
00d8da7
Update UnitsDB spec for Opal loader delegation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require "unitsdb" | ||
|
|
||
| module Unitsml | ||
| module Configuration | ||
| CONTEXT_ID = :unitsml_ruby | ||
|
|
||
| module_function | ||
|
|
||
| def context_id | ||
| CONTEXT_ID | ||
| end | ||
|
|
||
| def context(force_populate: false) | ||
| existing = ::Unitsdb::Config.find_context(context_id) | ||
| return existing if existing && !force_populate | ||
|
|
||
| build_context | ||
| end | ||
|
|
||
| def register_model(klass, id:) | ||
| registered_models[id.to_sym] = klass | ||
| end | ||
|
|
||
| def registered_models | ||
| @registered_models ||= {} | ||
| end | ||
|
|
||
| def build_context | ||
| ::Unitsdb::Config.context # ensure unitsdb context exists | ||
|
|
||
| substitutions = registered_models.each_value.filter_map do |klass| | ||
| parent = klass.superclass | ||
| next if parent == Object | ||
|
|
||
| { from_type: parent, to_type: klass } | ||
| end | ||
|
|
||
| ::Unitsdb::Config.populate_context( | ||
| id: context_id, | ||
| fallback_to: [::Unitsdb::Config.context_id], | ||
| substitutions: substitutions, | ||
| ) | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Unitsml | ||
| module Errors | ||
| class OpalPayloadNotBundledError < Unitsml::Errors::BaseError | ||
| def to_s | ||
| "[unitsml] Error: Opal database payload is not bundled." | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to_mathmlno longer callsnullify_mml_models/reset_mml_models, but the private methods remain in this file and are now unused. Consider removing them to reduce maintenance surface, or reintroduce the call site if they are still required for Plurimath/MML interoperability.