Add Opal database payload loader#65
Open
suleman-uzair wants to merge 2 commits intomainfrom
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a dedicated Opal-only hook to inject a bundled UnitsDB payload at runtime, allowing Opal consumers to use Unitsml::Unitsdb::Database.from_db without subclassing or re-implementing loading behavior.
Changes:
- Add
Unitsml::Unitsdb::Database.load_opal_payloadandopal_payloadhelpers to support injected payloads (with fallback to theDATABASEconstant). - Update Opal
from_dbpath to use the newopal_payloadaccessor and raise when missing. - Extend specs to cover the new Opal payload injection behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/unitsml/unitsdb/database.rb | Introduces load_opal_payload/opal_payload and switches Opal loading to use the payload accessor. |
| spec/unitsml/unitsdb/database_spec.rb | Resets Opal payload between examples and adds coverage for the new payload injection hook. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds an explicit
Unitsml::Unitsdb::Database.load_opal_payloadhook for Opal builds.This lets downstream packages provide the bundled UnitsDB payload without generating subclasses or reimplementing
from_db. The Opal loader remains owned byunitsml-ruby, including the missing-payload error path.