You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This small Rubygem does its best at taking a user-input string like "john 3:16" and turning it into something useful
for querying a database (this is how we use it in bible_api).
You can then take this and turn it into a few small SQL queries like this:
verses=ranges.mapdo |from_ref,to_ref|
first=DB['select id from verses where book = :book and chapter = :chapter and verse = :verse limit 1',from_ref].firstlast=DB['select id from verses where book = :book and chapter = :chapter and verse = :verse limit 1',to_ref].firstDB['select * from verses where id between ? and ?',first['id'],last['id']]end
Single-Chapter Book Matching
Passing single_chapter_book_matching keyword to Reference changes how single-chapter books are handled.
It affects how something like Jude 1 is parsed:
setting
input
result
:special (default)
jude 1
single verse of Jude 1:1
:indifferent
jude 1
whole chapter of Jude
While the default of :special seems to match what most people expect, using the :indifferent setting will make jude 1
behave the same as something like john 1 -- both will return the entire chapter.