Class: VerseCount

Inherits:
Object
  • Object
show all
Defined in:
lib/verse_count.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, chapter, verseTotal) ⇒ VerseCount

Returns a new instance of VerseCount.



7
8
9
10
11
# File 'lib/verse_count.rb', line 7

def initialize(name, chapter, verseTotal)
	@name = name
	@chapter = chapter
	@verseTotal = verseTotal
end

Class Method Details

.getBooksOfBibleObject



30
31
32
# File 'lib/verse_count.rb', line 30

def self.getBooksOfBible
	return @wholeBible.keys
end

.getNumberOfChapters(bookTitle) ⇒ Object



34
35
36
# File 'lib/verse_count.rb', line 34

def self.getNumberOfChapters(bookTitle)
	return @wholeBible[bookTitle].values.length
end

.getTotalBookVerseCountObject



42
43
44
45
46
47
48
49
50
51
52
# 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) ⇒ Object



38
39
40
# File 'lib/verse_count.rb', line 38

def self.getVerseCountForChapter(bookTitle, chapNum)
	return @wholeBible[bookTitle][chapNum]
end

.initObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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