Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ref schema URI construction.
This refactors JSON::Validator#load_ref_schema to not implement a lot of logic that Pathname and URI are already capable of, and splits some of it into a separate method for clarity. Some JSON::Validator class methods are also added to hide away the specific implementation of how already loaded schemas are kept around. * Refactor JSON::Validator#load_schema_ref to move absolute URI construction to its own method, and to bail ASAP if the schema is already loaded. * Add JSON::Validator#absolutize_ref_uri to handle logic around constructing an absolute URI to a schema based on the ref URI and its parent schema URI. * Add JSON::Validator.schema_for_uri to fetch an already loaded schema for a given URI. * Add JSON::Validator.schema_loaded? predicate method for testing whether a schema is already loaded. * Move some existing code to use the new class methods.
- Loading branch information