Class: Store
- Inherits:
-
Object
- Object
- Store
- Defined in:
- lib/wiki/stores/store.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.app_root ⇒ Object
writeonly
Sets the attribute app_root.
Class Method Summary collapse
-
.get_hash(path) ⇒ Object
(also: get_page)
GET.
- .method_missing(*args) ⇒ Object
-
.put_hash(path, ruby_data, metadata = {}) ⇒ Object
(also: put_page)
PUT.
- .set(store_classname, app_root) ⇒ Object
Class Attribute Details
.app_root=(value) ⇒ Object (writeonly)
Sets the attribute app_root
4 5 6 |
# File 'lib/wiki/stores/store.rb', line 4 def app_root=(value) @app_root = value end |
Class Method Details
.get_hash(path) ⇒ Object Also known as: get_page
GET
20 21 22 23 |
# File 'lib/wiki/stores/store.rb', line 20 def get_hash(path) json = get_text path JSON.parse json if json end |
.method_missing(*args) ⇒ Object
13 14 15 16 |
# File 'lib/wiki/stores/store.rb', line 13 def method_missing(*args) # For any method not implemented in *this* class, pass the method call through to the designated Store subclass @store_class.send(*args) end |
.put_hash(path, ruby_data, metadata = {}) ⇒ Object Also known as: put_page
PUT
29 30 31 32 33 |
# File 'lib/wiki/stores/store.rb', line 29 def put_hash(path, ruby_data, ={}) json = JSON.pretty_generate(ruby_data) put_text path, json, ruby_data end |
.set(store_classname, app_root) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/wiki/stores/store.rb', line 6 def set(store_classname, app_root) # @store_class is literally the class FileStore by default, or if a class name is passed in, another subclass of Store @store_class = store_classname ? Kernel.const_get(store_classname) : FileStore @store_class.app_root = app_root @store_class end |