| Class | MusicExtras::DataAccessor |
| In: |
lib/musicextras/dataaccessor.rb
|
| Parent: | Object |
DataAccessor class provides the interface between data classes and plugins. It allows plugins to register with the class. When someone calls a method of the class that doesn’t exist, the registered plugins are checked for implementations of the method. Whatever (non-nil) data returned from a plugin is used
Setups up cache. Data Accessors should be sure to call super
This method should be called in the initialize() for each plugin. It should be called one time per accessor method.
Replaces tags with correct values. Each data accessor should implement this. Eg: Song would replace {TITLE} with the correct title Return the new string
Determines the filename the data should be cached under
Returns nil if no accessors are found
Data is retrieved using the accessor information. First the cache is checked. If that fails, the accessor fetch methods are called. If data is retrieved, it is saved in the cache and returned. Otherwise nil is returned
Whenever a method doesn’t exist, we check if there are any registered accessors to handle it. Raises AccessorNotImplemented when none of the registred plugins implement the method