Class: SafeDb::Goto
- Inherits:
-
Controller
- Object
- Controller
- SafeDb::Goto
- Defined in:
- lib/controller/navigate/goto.rb
Overview
Goto is a shortcut (or alias even) for the open command that takes an integer index that effectively specifies which chapter and verse to open.
Use view to list the valid integer indices for each chapter and verse combination.
View maps out and numbers each chapter/verse combination. Goto with the number effectively shortcuts the open pinpointer. Show prints out the verse lines at the opened path but masks any secrets. Tell also prints out the verse lines but unabashedly displays secrets.
Instance Attribute Summary collapse
-
#index ⇒ Object
writeonly
The index (number) starting with 1 of the envelope and key-path combination that should be opened.
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
#index=(value) ⇒ Object (writeonly)
The index (number) starting with 1 of the envelope and key-path combination that should be opened.
19 20 21 |
# File 'lib/controller/navigate/goto.rb', line 19 def index=(value) @index = value end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/controller/navigate/goto.rb', line 21 def execute goto_location = 0 @book.branch_chapter_keys().each_pair do | chapter_name, chapter_keys | chapter_data = Content.unlock_branch_chapter( chapter_keys ) chapter_data.each_key do | verse_name | goto_location += 1 next unless @index.to_i == goto_location open_uc = Open.new open_uc.chapter = chapter_name open_uc.verse = verse_name open_uc.flow() return end end end |