Class: GOM::Storage::Filesystem::Adapter
- Inherits:
-
Adapter
- Object
- Adapter
- GOM::Storage::Filesystem::Adapter
- Defined in:
- lib/gom/storage/filesystem/adapter.rb
Overview
The filesystem storage adapter
Instance Attribute Summary collapse
-
#drafts ⇒ Object
readonly
Returns the value of attribute drafts.
Instance Method Summary collapse
- #collection(view_name, options = { }) ⇒ Object
- #count ⇒ Object
- #fetch(id) ⇒ Object
- #remove(*arguments) ⇒ Object
- #setup ⇒ Object
- #store(*arguments) ⇒ Object
- #teardown ⇒ Object
Instance Attribute Details
#drafts ⇒ Object (readonly)
Returns the value of attribute drafts.
5 6 7 |
# File 'lib/gom/storage/filesystem/adapter.rb', line 5 def drafts @drafts end |
Instance Method Details
#collection(view_name, options = { }) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/gom/storage/filesystem/adapter.rb', line 35 def collection(view_name, = { }) check_setup configuration = self.configuration view = configuration.views[view_name.to_sym] raise ViewNotFoundError, "there are no view with the name #{view_name}" unless view GOM::Object::Collection.new GOM::Storage::Filesystem::Collection::Fetcher.new(@drafts, view), configuration.name end |
#count ⇒ Object
30 31 32 33 |
# File 'lib/gom/storage/filesystem/adapter.rb', line 30 def count check_setup @drafts.size end |
#fetch(id) ⇒ Object
15 16 17 18 |
# File 'lib/gom/storage/filesystem/adapter.rb', line 15 def fetch(id) check_setup @drafts[id] end |
#remove(*arguments) ⇒ Object
25 26 27 28 |
# File 'lib/gom/storage/filesystem/adapter.rb', line 25 def remove(*arguments) check_setup read_only_error end |
#setup ⇒ Object
7 8 9 |
# File 'lib/gom/storage/filesystem/adapter.rb', line 7 def setup load_drafts end |
#store(*arguments) ⇒ Object
20 21 22 23 |
# File 'lib/gom/storage/filesystem/adapter.rb', line 20 def store(*arguments) check_setup read_only_error end |
#teardown ⇒ Object
11 12 13 |
# File 'lib/gom/storage/filesystem/adapter.rb', line 11 def teardown @drafts = nil end |