Class: Wings::ModelTransformer::ResourceClassCache
- Inherits:
-
Object
- Object
- Wings::ModelTransformer::ResourceClassCache
- Includes:
- Singleton
- Defined in:
- lib/wings/model_transformer.rb
Overview
Caches dynamically generated ‘Valkyrie::Resource` subclasses mapped from legacy `ActiveFedora` model classes.
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
Instance Method Summary collapse
- #fetch(key) ⇒ Class
-
#initialize ⇒ ResourceClassCache
constructor
A new instance of ResourceClassCache.
Constructor Details
#initialize ⇒ ResourceClassCache
Returns a new instance of ResourceClassCache.
132 133 134 |
# File 'lib/wings/model_transformer.rb', line 132 def initialize @cache = {} end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
130 131 132 |
# File 'lib/wings/model_transformer.rb', line 130 def cache @cache end |
Instance Method Details
#fetch(key) ⇒ Class
140 141 142 143 144 |
# File 'lib/wings/model_transformer.rb', line 140 def fetch(key) @cache.fetch(key) do @cache[key] = yield end end |