Class: KjLite::Verse
- Inherits:
-
Object
- Object
- KjLite::Verse
- Defined in:
- lib/kjlite.rb
Instance Attribute Summary collapse
-
#book_id ⇒ Object
readonly
Returns the value of attribute book_id.
-
#chapter_id ⇒ Object
readonly
Returns the value of attribute chapter_id.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
-
#initialize(book_name, chapter_id, number, verse, debug: false) ⇒ Verse
constructor
A new instance of Verse.
- #inspect ⇒ Object
- #text ⇒ Object
- #title ⇒ Object
- #to_s ⇒ Object
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_id ⇒ Object (readonly)
Returns the value of attribute book_id.
14 15 16 |
# File 'lib/kjlite.rb', line 14 def book_id @book_id end |
#chapter_id ⇒ Object (readonly)
Returns the value of attribute chapter_id.
14 15 16 |
# File 'lib/kjlite.rb', line 14 def chapter_id @chapter_id end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
14 15 16 |
# File 'lib/kjlite.rb', line 14 def number @number end |
Instance Method Details
#inspect ⇒ Object
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 |
#text ⇒ Object
26 27 28 |
# File 'lib/kjlite.rb', line 26 def text() @verse[/^\d+:\d+:\d+\s+(.*)/m,1].gsub(/[\r\n]|\s\s/,'') end |
#title ⇒ Object
30 31 32 |
# File 'lib/kjlite.rb', line 30 def title() "%s %s:%s" % [@book_name, @chapter_id, @number] end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/kjlite.rb', line 34 def to_s() @verse end |