Class: Aspire::Object::Factory
- Inherits:
-
Object
- Object
- Aspire::Object::Factory
- Includes:
- Util
- Defined in:
- lib/aspire/object/factory.rb
Overview
A factory returning reading list objects given the object’s URI
Constant Summary
Constants included from Util
Instance Attribute Summary collapse
-
#cache ⇒ Aspire::Caching::Cache
The cache for retrieving data.
-
#users ⇒ Hash<String, Aspire::Object::User>
A hash of user profiles indexed by URI.
Instance Method Summary collapse
-
#get(uri = nil, parent = nil, json: nil, ld: nil) ⇒ Aspire::Object::ListBase
Returns a new API list object (Aspire::Object::ListBase subclass) given its URI.
-
#initialize(cache, users = nil) ⇒ void
constructor
Initialises a new Factory instance.
Methods included from Util
#child_url?, #duration, #id_from_uri, #item?, #linked_data, #linked_data_path, #list?, #list_url?, #module?, #parent_url?, #parse_url, #resource?, #section?, #url_for_comparison, #url_path, #user?
Constructor Details
#initialize(cache, users = nil) ⇒ void
Initialises a new Factory instance
26 27 28 29 |
# File 'lib/aspire/object/factory.rb', line 26 def initialize(cache, users = nil) self.cache = cache self.users = users || {} end |
Instance Attribute Details
#cache ⇒ Aspire::Caching::Cache
Returns the cache for retrieving data.
14 15 16 |
# File 'lib/aspire/object/factory.rb', line 14 def cache @cache end |
#users ⇒ Hash<String, Aspire::Object::User>
Returns a hash of user profiles indexed by URI.
19 20 21 |
# File 'lib/aspire/object/factory.rb', line 19 def users @users end |
Instance Method Details
#get(uri = nil, parent = nil, json: nil, ld: nil) ⇒ Aspire::Object::ListBase
Returns a new API list object (Aspire::Object::ListBase subclass) given its URI
38 39 40 41 42 |
# File 'lib/aspire/object/factory.rb', line 38 def get(uri = nil, parent = nil, json: nil, ld: nil) return nil if uri.nil? || uri.empty? get_exceptions(uri, parent, json: json, ld: ld) || get_linked_data(uri, parent, json: json, ld: ld) end |