-
Notifications
You must be signed in to change notification settings - Fork 65
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
Changes dynamic and lexical schemas to be stored internally by the URI as a string #189
base: main
Are you sure you want to change the base?
Conversation
end | ||
|
||
def register(type, namespace_uri, schema) | ||
@resources[type][namespace_uri.to_s] = schema |
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.
@resources[type][namespace_uri.to_s] = schema | |
fail "Schema already registered as #{type} under #{namespace_uri}" if @resources[type][namespace_uri.to_s] | |
@resources[type][namespace_uri.to_s] = schema |
Check whether the URI is already used for possibly another schema. It makes a couple of tests fail though.
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.
Sorry for the delay—thanks for opening this!
@resources[type][namespace_uri.to_s] = schema | ||
end | ||
|
||
def lexical!(namespace_uri) |
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.
Let's just call these uri
—I don't know if "namespace" is the right terminology here.
@@ -328,7 +327,7 @@ def defs_keyword | |||
end | |||
|
|||
def resources | |||
@resources ||= { :lexical => {}, :dynamic => {} } |
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.
I think instead of wrapping both of these in a single object, we should pull them into separate objects. Something like:
def resources
@resources ||= { :lexical => Resources.new, :dynamic => Resources.new }
end
Or even separate lexical_resources
and dynamic_resources
methods.
And then on Resources
you just have to define the Hash
methods that we're using (#[]
, #[]=
, #fetch
, and #key?
).
Fixes #188