Class: GOM::Storage::Filesystem::Adapter

Inherits:
Adapter
  • Object
show all
Defined in:
lib/gom/storage/filesystem/adapter.rb

Overview

The filesystem storage adapter

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#draftsObject (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

Raises:

  • (ViewNotFoundError)


35
36
37
38
39
40
41
# File 'lib/gom/storage/filesystem/adapter.rb', line 35

def collection(view_name, options = { })
  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

#countObject



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

#setupObject



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

#teardownObject



11
12
13
# File 'lib/gom/storage/filesystem/adapter.rb', line 11

def teardown
  @drafts = nil
end