Class: SafeDb::Open

Inherits:
Controller show all
Defined in:
lib/controller/navigate/open.rb

Overview

The open use case allows us to add (put), subtract (remove), change (update) and list the credential within first a chapter (outer) and then within a verse (inner), of the logged in book.

safe reopen <<chapter>> <<verse>>

If you need to be sure that you are re-opening a chapter and verse that already exists you use the safe reopen command. This command produces an error if it cannot find specified chapter and verse.

Instance Attribute Summary collapse

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 Attribute Details

#chapter=(value) ⇒ Object (writeonly)

The chapter and verse of this book that are to be opened.



18
19
20
# File 'lib/controller/navigate/open.rb', line 18

def chapter=(value)
  @chapter = value
end

#verse=(value) ⇒ Object (writeonly)

The chapter and verse of this book that are to be opened.



18
19
20
# File 'lib/controller/navigate/open.rb', line 18

def verse=(value)
  @verse = value
end

Instance Method Details

#executeObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/controller/navigate/open.rb', line 20

def execute

  @book.set_open_chapter_name( @chapter )
  @book.set_open_verse_name( @verse )
  @book.write()

  # Show the mini dictionary at the opened chapter and verse location
  # More work is needed when for when only the chapter is opened in
  # which case we should show the list of verses and perhaps the count
  # of key value pairs each verse contains.
  Show.new.flow()

end