0.0
No release in over 3 years
Low commit activity in last 3 years
bible_passage provides a facility for parsing a string to check its validity as a Bible reference, and then render it in a consistent manner.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 2.6
~> 3.0
 Project Readme

bible_passage

A simple library for parsing and rendering bible passages.

Usage

The most common usage of bible_passage will be to parse a reference string, which will return a new BiblePassage::Reference object

ref = BiblePassage::Reference.parse "gen 1:2-3"

This BiblePassage::Reference object can be output as a string

> ref.to_s
=> "Genesis 1:2-3"

bible_passage can handle common book name abbreviations, and will also simplify references where appropriate, eg.

> BiblePassage::Reference.parse("Genesis 1:1-50:26").to_s
=> "Genesis"

It will check the validity of references and throw a BiblePassage::InvalidReferenceError if a reference is not valid

> BiblePassage::Reference.parse("mt 3-1")
BiblePassage::InvalidReferenceError: to_chapter cannot be before from_chapter

> BiblePassage::Reference.parse("Exudos")
BiblePassage::InvalidReferenceError: Exudos is not a valid book

> BiblePassage::Reference.parse("Ex 41")
BiblePassage::InvalidReferenceError: Exodus doesn't have a chapter 41

License

bible_passage is distributed under the MIT License.