Class: Noumenon::ContentRepository
- Inherits:
-
Object
- Object
- Noumenon::ContentRepository
- Defined in:
- lib/noumenon/content_repository.rb
Overview
The base class for content repositories. This class is predominantly present just to document the expected API for a repository.
Direct Known Subclasses
Defined Under Namespace
Classes: FileSystem
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Provides access to options set on initialization.
Instance Method Summary collapse
-
#children(root = "/", depth = 1) ⇒ Array, #each
Returns an array of content items below the root specified.
-
#get(path) ⇒ Hash, ...
Load an item from the repository.
-
#initialize(options = {}) ⇒ ContentRepository
constructor
Create a new Repository instance.
-
#put(path, content) ⇒ Object
Save an item in the repository.
Constructor Details
#initialize(options = {}) ⇒ ContentRepository
Create a new Repository instance.
18 19 20 |
# File 'lib/noumenon/content_repository.rb', line 18 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Provides access to options set on initialization.
12 13 14 |
# File 'lib/noumenon/content_repository.rb', line 12 def @options end |
Instance Method Details
#children(root = "/", depth = 1) ⇒ Array, #each
Returns an array of content items below the root specified. If depth is greater then 1 that many sub-directories will also be checked, with any items in those being placed in a ‘:children` attribute on the parent.
60 61 62 |
# File 'lib/noumenon/content_repository.rb', line 60 def children(root = "/", depth = 1) not_supported "listing children from a path" end |
#get(path) ⇒ Hash, ...
Load an item from the repository. If the item does not exist then ‘nil` should be returned.
36 37 38 |
# File 'lib/noumenon/content_repository.rb', line 36 def get(path) not_supported "reading it's contents" end |
#put(path, content) ⇒ Object
Save an item in the repository. If an item already exists then it should be overwritten.
27 28 29 |
# File 'lib/noumenon/content_repository.rb', line 27 def put(path, content) not_supported "updating it's contents" end |