Class: SafeDb::EditVerse

Inherits:
Controller show all
Defined in:
lib/controller/abstract/edit_verse.rb

Overview

Any Controller class wishing to edit a safe verse can make use of the functionality in this parent by exposing an edit_verse() method.

Classes extending this class will have access to

  • a @chapther_data data structure

  • a @chapther_id string index

  • a @has_chapter boolean indicator

  • a @verse_data data structure

  • a @verse_id string index

  • a @has_verse boolean indicator

After the edit method completes the amended chapter data structure will be encrypted and streamed to a ciphertext file.

Instance Method Summary collapse

Methods inherited from Controller

#check_post_conditions, #check_pre_conditions, #flow, #initialize, #open_remote_backend_location, #post_validation, #pre_validation, #read_verse, #set_verse, #update_verse

Constructor Details

This class inherits a constructor from SafeDb::Controller

Instance Method Details

#executeObject

This parental behaviour sets up common ubiquitous chapter and verse data structures and indices. It then calls the child’s query_verse() behaviour and once that is complete it encrypts and persists an (updated) Book and the amended chapter.

The streaming process also deletes the current (old) Book and chapter crypts.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/controller/abstract/edit_verse.rb', line 26

def execute

  # Before calling the edit_verse() method we perform some
  # preparatory activities that check, validate and setup.
  read_verse()

  # This is the expected edit() method that will do and deliver
  # the intented core contracted value proposition.
  edit_verse()

  # Now encrypt the changed verse and then write it out to a
  # chapter crypt file whilst garbage collecting the now spurious
  # and superceded script.
  update_verse()


end