Class: URIResolver::TreeResolver
- Inherits:
-
ResolverType
- Object
- ResolverType
- URIResolver::TreeResolver
- Defined in:
- backend/app/lib/uri_resolver.rb
Overview
A resolver for the record tree types (resource, digital object & classification trees)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(model) ⇒ TreeResolver
constructor
A new instance of TreeResolver.
-
#record_exists?(uri) ⇒ Boolean
-
#resolve(uris) ⇒ Object
Constructor Details
#initialize(model) ⇒ TreeResolver
Returns a new instance of TreeResolver.
406 407 408 |
# File 'backend/app/lib/uri_resolver.rb', line 406 def initialize(model) @model = model end |
Class Method Details
.handler_for(jsonmodel_type) ⇒ Object
401 402 403 404 |
# File 'backend/app/lib/uri_resolver.rb', line 401 def self.handler_for(jsonmodel_type) model = model_for_tree(jsonmodel_type) new(model) if model end |
Instance Method Details
#record_exists?(uri) ⇒ Boolean
419 420 421 422 423 424 425 |
# File 'backend/app/lib/uri_resolver.rb', line 419 def record_exists?(uri) # Trees have historically been given a free pass here, and it seems that # the current unit tests are relying on this. I guess it's never caused a # problem, but this could conceivably do the same check as the regular # ASModel resolver. true end |
#resolve(uris) ⇒ Object
410 411 412 413 414 415 416 417 |
# File 'backend/app/lib/uri_resolver.rb', line 410 def resolve(uris) Enumerator.new do |yielder| uris.each do |uri| id = JSONModel.parse_reference(uri)[:id] yielder << [uri, @model[id].tree.to_hash(:trusted)] end end end |