Class: Quby::Questionnaires::Repos::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/quby/questionnaires/repos/base.rb

Direct Known Subclasses

BundleDiskRepo, DiskRepo, MemoryRepo

Instance Method Summary collapse

Instance Method Details

#allObject



9
10
11
# File 'lib/quby/questionnaires/repos/base.rb', line 9

def all
  keys.map { |key| find(key) }
end

#create!(key, sourcecode) ⇒ Object



25
26
27
28
29
# File 'lib/quby/questionnaires/repos/base.rb', line 25

def create!(key, sourcecode)
  fail(DuplicateQuestionnaire, key) if exists?(key)
  store!(key, sourcecode)
  find(key)
end

#exists?(key) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/quby/questionnaires/repos/base.rb', line 17

def exists?(key)
  fail NotImplementedError
end

#find(key) ⇒ Object



13
14
15
# File 'lib/quby/questionnaires/repos/base.rb', line 13

def find(key)
  fail NotImplementedError
end

#timestamp(key) ⇒ Object



21
22
23
# File 'lib/quby/questionnaires/repos/base.rb', line 21

def timestamp(key)
  fail NotImplementedError
end

#update!(key, sourcecode) ⇒ Object



31
32
33
34
35
# File 'lib/quby/questionnaires/repos/base.rb', line 31

def update!(key, sourcecode)
  fail(QuestionnaireNotFound, key) unless exists?(key)
  store!(key, sourcecode)
  find(key)
end