Class: SafeDb::Coordinates
- Inherits:
-
Object
- Object
- SafeDb::Coordinates
- Defined in:
- lib/model/coordinates.rb
Overview
Coordinates point to either a book, or a book/chapter or a book/chapter/verse location. The location pointed to may or may not exist and even if they do they may not be accessible if they exist within a book that (as of yet) we have not logged into.
Instance Method Summary collapse
-
#exists? ⇒ Boolean
Do the (book, chapter or verse) that our said coordinates point to exist.
-
#initialize(coordinates_str) ⇒ Coordinates
constructor
Initialize coordinates to a location within a book and/or chapter and/or verse.
-
#is_book? ⇒ Boolean
Do our coordinates point to any currently logged in book.
-
#is_chapter? ⇒ Boolean
Do our coordinates point to an existing chapter within the currently logged in book.
-
#is_verse? ⇒ Boolean
Do our coordinates point to an existing verse in a chapter within the current logged in book.
Constructor Details
#initialize(coordinates_str) ⇒ Coordinates
Initialize coordinates to a location within a book and/or chapter and/or verse.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/model/coordinates.rb', line 17 def initialize( coordinates_str ) KeyError.not_new( coordinates_str, self ) @coords_list = @coords_list.split( "/" ) bcv_error_msg = "Invalid / separated book chapter and verse coordinates ~> #{@coords_list}" raise ArgumentError.new( bcv_error_msg ) unless @coords_list.length() == 3 @book_name = @coords_list[ 0 ].strip() @chapter_name = @coords_list[ 1 ].strip() @verse_name = @coords_list[ 2 ].strip() log.info(x) { "Initializing a book chapter and verse coordinate within book [#{@book_name}]." } end |
Instance Method Details
#exists? ⇒ Boolean
Do the (book, chapter or verse) that our said coordinates point to exist.
35 36 |
# File 'lib/model/coordinates.rb', line 35 def exists?() end |
#is_book? ⇒ Boolean
Do our coordinates point to any currently logged in book.
52 53 |
# File 'lib/model/coordinates.rb', line 52 def is_book?() end |
#is_chapter? ⇒ Boolean
Do our coordinates point to an existing chapter within the currently logged in book.
47 48 |
# File 'lib/model/coordinates.rb', line 47 def is_chapter?() end |
#is_verse? ⇒ Boolean
Do our coordinates point to an existing verse in a chapter within the current logged in book.
41 42 |
# File 'lib/model/coordinates.rb', line 41 def is_verse?() end |