Class: SafeDb::At

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

Overview

The at use case is all about opening books at the right page. Its operation is similar to safe open and safe goto.

It takes one and only one parameter which can consist of 1, 2 or 3 forward slash separated parts.

$ safe at /contacts      # login or switch to the contacts book
$ safe at /contacts/friends      # go to the friends chapter in contacts
$ safe at /contacts/friends/paul # go to the paul verse in contacts
$ safe at contacts/friends/paul  # the same as above
$ safe at mary                   # if already in friends chapter
$ safe at ../family/mum             #

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.



22
23
24
# File 'lib/controller/navigate/at.rb', line 22

def chapter=(value)
  @chapter = value
end

#verse=(value) ⇒ Object (writeonly)

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



22
23
24
# File 'lib/controller/navigate/at.rb', line 22

def verse=(value)
  @verse = value
end

Instance Method Details

#executeObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/controller/navigate/at.rb', line 24

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