Class: KjLite::Verse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(book_name, chapter_id, number, verse, debug: false) ⇒ Verse

Returns a new instance of Verse.



16
17
18
19
# File 'lib/kjlite.rb', line 16

def initialize(book_name, chapter_id, number, verse, debug: false)
  @book_name, @chapter_id, @debug = book_name, chapter_id, debug
  @number, @verse = number, verse
end

Instance Attribute Details

#book_idObject (readonly)

Returns the value of attribute book_id.



14
15
16
# File 'lib/kjlite.rb', line 14

def book_id
  @book_id
end

#chapter_idObject (readonly)

Returns the value of attribute chapter_id.



14
15
16
# File 'lib/kjlite.rb', line 14

def chapter_id
  @chapter_id
end

#numberObject (readonly)

Returns the value of attribute number.



14
15
16
# File 'lib/kjlite.rb', line 14

def number
  @number
end

Instance Method Details

#inspectObject



21
22
23
24
# File 'lib/kjlite.rb', line 21

def inspect()
  "#<KjLite::Verse @book_name=#{@book_name} " +
    "@chapter_id=#{@chapter_id} @number=#{@number}>"
end

#textObject



26
27
28
# File 'lib/kjlite.rb', line 26

def text()
  @verse[/^\d+:\d+:\d+\s+(.*)/m,1].gsub(/[\r\n]|\s\s/,'')
end

#titleObject



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

def title()
  "%s %s:%s" % [@book_name, @chapter_id, @number]
end

#to_sObject



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

def to_s()
  @verse
end