class ActsAsScriptural::AbbreviationLookup

Public Class Methods

new() click to toggle source
# File lib/acts_as_scriptural/abbreviation_lookup.rb, line 7
def initialize
  @hash = bible.book_names.abbrev.map{|k,v| [k.gsub(' ','').downcase,v]}.to_h
end

Public Instance Methods

abbreviation_to_book(str) click to toggle source
# File lib/acts_as_scriptural/abbreviation_lookup.rb, line 23
def abbreviation_to_book(str)
  bible.namehash[fullname(str)]
end
bible() click to toggle source
# File lib/acts_as_scriptural/abbreviation_lookup.rb, line 19
def bible
  @bible || ActsAsScriptural::Bible.new
end
fullname(str) click to toggle source
# File lib/acts_as_scriptural/abbreviation_lookup.rb, line 11
def fullname(str)
  @hash[str.gsub(' ','').downcase]
end
index_number(str) click to toggle source
# File lib/acts_as_scriptural/abbreviation_lookup.rb, line 15
def index_number(str)
  bible.namehash[fullname(str)].index 
end