class VerseCount
Public Class Methods
getBooksOfBible()
click to toggle source
# File lib/verse_count.rb, line 30 def self.getBooksOfBible return @wholeBible.keys end
getNumberOfChapters(bookTitle)
click to toggle source
# File lib/verse_count.rb, line 34 def self.getNumberOfChapters(bookTitle) return @wholeBible[bookTitle].values.length end
getTotalBookVerseCount()
click to toggle source
# File lib/verse_count.rb, line 42 def self.getTotalBookVerseCount @allChapters = Hash.new @wholeBible.each do |wb| chapterCount = Hash.new wb[1].each do |chapter, verseCount| chapterCount[chapter] = verseCount end @allChapters[wb[0]] = chapterCount end return @allChapters end
getVerseCountForChapter(bookTitle, chapNum)
click to toggle source
# File lib/verse_count.rb, line 38 def self.getVerseCountForChapter(bookTitle, chapNum) return @wholeBible[bookTitle][chapNum] end
init()
click to toggle source
# File lib/verse_count.rb, line 13 def self.init CSV.new(open("https://raw.githubusercontent.com/kkuivenhoven/VerseCount/master/lib/BookChapNums.csv")).each do |bookLine| @verseCount = Hash.new i = 0 chapter = 1 bookLine.each do |bLine| if i > 2 @verseCount[chapter] = bLine chapter += 1 end i += 1 end @wholeBible[bookLine[1]] = @verseCount end return "init complete" end
new(name, chapter, verseTotal)
click to toggle source
# File lib/verse_count.rb, line 7 def initialize(name, chapter, verseTotal) @name = name @chapter = chapter @verseTotal = verseTotal end