bible_ref 1.9.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e0b787413a48a2a6788eaec420755be004d9ed32786c9a105e3025507a2e843
4
- data.tar.gz: '03793a39b9ceeca6043620322be60201d5d4ce3238946a9e08eb933afa901c9a'
3
+ metadata.gz: 289edfed9344b42456cd5f107d8fdd3197dbc14f3f28a7a92c8258f387fdac7a
4
+ data.tar.gz: 6f8bbaf0415d8d1d2d5d23251616f01d7f931a9e27701218cad6f4ce0b70b9dc
5
5
  SHA512:
6
- metadata.gz: 837e7f136544e11b9f8033e72d990de67280457312a8cf48b412ac6d9742a994003c2b39b791db9044fccc21dfa54ec21b4347f91ed7275b18055fbe5350d02c
7
- data.tar.gz: 5a50e55e950dabe2988df1775332e89b8760886b5df82428d4d6b7994e7c138d1bca4b13971f4606449de1a51d531494b3c1c1a4677bcf6754035f53e70eba28
6
+ metadata.gz: ba2f800f04d6c46f67c629780348beba179efb6c6a63072fb30a0f6afafd48b92fb1a9defd3c9cfbdda9b3f193fc7dd48c46d43fbb314d1641297a07530983f1
7
+ data.tar.gz: de3d6f6a6af1d897891b56bd44db56e4aba0f1c884d138d1ac2c23a1d561096828ffc4f2b35a7dffb7c52fc64b0e1ed23c103c0e1e97704c3944118cb87e55b1
@@ -5,21 +5,17 @@ module BibleRef
5
5
  fail NotImplementedError, "You must override #books in your language class."
6
6
  end
7
7
 
8
- # Is it a single chapter book?
9
- def has_single_chapter?(reference)
10
- fail NotImplementedError, "You must override #has_single_chapter? in your language class."
11
- end
12
-
13
8
  def book_id(book_name, canon)
14
9
  book_name = replace_roman_numerals(book_name)
15
10
  return book_name.upcase if books[book_name.upcase] # already normalized
11
+
16
12
  canon.books.each do |book|
17
13
  details = books[book]
18
14
  next if details.nil?
19
15
  if (match = details[:match])
20
- return book if book_name.downcase =~ match
16
+ return book if book_name.downcase =~ match || book_name =~ match
21
17
  else
22
- return book if book_name.downcase == details[:name].downcase
18
+ return book if book_name.downcase == details[:name].downcase || book_name == details[:name]
23
19
  end
24
20
  end
25
21
  nil
@@ -4,13 +4,6 @@ require_relative 'base'
4
4
  module BibleRef
5
5
  module Languages
6
6
  class Cherokee < Base
7
-
8
- # Is it a single chapter book?
9
- def has_single_chapter?(reference)
10
- matches = ['ᏉᎳ ᏆᎵᎹᏂ ᎤᏬᏪᎳᏁᎸᎯ', 'ᏣᏂ ᏔᎵᏁ ᎤᏬᏪᎳᏅᎯ', 'ᏣᏂ ᏦᎢᏁ ᎤᏬᏪᎳᏅᎯ', 'ᏧᏓᏏ ᎤᏬᏪᎳᏅᎯ']
11
- return matches.any? { |e| reference.include?(e) }
12
- end
13
-
14
7
  def books
15
8
  {
16
9
  'MAT' => { name: 'ᎣᏍᏛ ᎧᏃᎮᏛ ᎹᏚ ᎤᏬᏪᎳᏅᎯ' },
@@ -4,13 +4,6 @@ require_relative 'base'
4
4
  module BibleRef
5
5
  module Languages
6
6
  class Chinese < Base
7
-
8
- # Is it a single chapter book?
9
- def has_single_chapter?(reference)
10
- matches = [/^俄/, /^腓利門/, /^約翰貳/, /^約翰參/, /^猶/]
11
- return Regexp.union(matches).match?(reference)
12
- end
13
-
14
7
  def books
15
8
  {
16
9
  'GEN' => { match: /^創/, name: '創世紀'},
@@ -27,7 +20,7 @@ module BibleRef
27
20
  '2KI' => { match: /紀下$/, name: '列王紀下'},
28
21
  '1CH' => { match: /志上$/, name: '歷代志上'},
29
22
  '2CH' => { match: /志下$/, name: '歷代志下'},
30
- 'EZR' => { match: /^以斯/, name: '以斯拉記'},
23
+ 'EZR' => { match: /^以斯拉/, name: '以斯拉記'},
31
24
  'NEH' => { match: /^尼/, name: '尼希米記'},
32
25
  'EST' => { match: /帖記$/, name: '以斯帖記'},
33
26
  'JOB' => { match: /^約伯/, name: '約伯記'},
@@ -5,12 +5,6 @@ require_relative 'base'
5
5
  module BibleRef
6
6
  module Languages
7
7
  class Czech < Base
8
- # Is it a single chapter book?
9
- def has_single_chapter?(reference)
10
- matches = [/^ab/, /^(jud|juda)$/, /^2 ?jan/, /^3 ?jan/, /^fil/]
11
- Regexp.union(matches).match?(reference.downcase)
12
- end
13
-
14
8
  def books
15
9
  {
16
10
  'GEN' => { match: /^gen/, name: 'Genesis' },
@@ -20,30 +14,30 @@ module BibleRef
20
14
  'DEU' => { match: /^d(e?ut|eu)/, name: 'Deuteronomium' },
21
15
  'JOS' => { match: /^joz/, name: 'Jozue' },
22
16
  'JDG' => { match: /^soud/, name: 'Soudců' },
23
- 'RUT' => { match: /^ru/, name: 'Rút' },
24
- '1SA' => { match: /^1 ?s(a?m)?/, name: '1. Samuel' },
25
- '2SA' => { match: /^2 ?s(a?m)?/, name: '2. Samuel' },
26
- '1KI' => { match: /^1 ?kr(a?l)?/, name: '1. Královská' },
27
- '2KI' => { match: /^2 ?kr(a?l)?/, name: '2. Královská' },
28
- '1CH' => { match: /^1 ?p(ar)?/, name: '1. Paralipomenon' },
29
- '2CH' => { match: /^2 ?p(ar)?/, name: '2. Paralipomenon' },
30
- 'EZR' => { match: /^ezr/, name: 'Ezdráš' },
17
+ 'RUT' => { match: /^r[uú]/, name: 'Rút' },
18
+ '1SA' => { match: /^1\.? ?s(a?m)?/, name: '1. Samuel' },
19
+ '2SA' => { match: /^2\.? ?s(a?m)?/, name: '2. Samuel' },
20
+ '1KI' => { match: /^1\.? ?kr(a?l)?/, name: '1. Královská' },
21
+ '2KI' => { match: /^2\.? ?kr(a?l)?/, name: '2. Královská' },
22
+ '1CH' => { match: /^1\.? ?par/, name: '1. Paralipomenon' },
23
+ '2CH' => { match: /^2\.? ?par/, name: '2. Paralipomenon' },
24
+ 'EZR' => { match: /^ezd/, name: 'Ezdráš' },
31
25
  'NEH' => { match: /^ne/, name: 'Nehemiáš' },
32
26
  'EST' => { match: /^est/, name: 'Ester' },
33
27
  'JOB' => { match: /^jo?b/, name: 'Job' },
34
- 'PSA' => { match: /^za/, name: 'Žalmy' },
35
- 'PRO' => { match: /^pri/, name: 'Přísloví' },
28
+ 'PSA' => { match: /^zal|^žal/, name: 'Žalmy' },
29
+ 'PRO' => { match: /^p[řr]/, name: 'Přísloví' },
36
30
  'ECC' => { match: /^kaz/, name: 'Kazatel' },
37
- 'SNG' => { match: /^pis/, name: 'Píseň písní' },
31
+ 'SNG' => { match: /^p[ií]/, name: 'Píseň písní' },
38
32
  'ISA' => { match: /^iza/, name: 'Izaiáš' },
39
33
  'JER' => { match: /^jer/, name: 'Jeremiáš' },
40
- 'LAM' => { match: /^plac/, name: 'Pláč' },
34
+ 'LAM' => { match: /^pl[aá]/, name: 'Pláč' },
41
35
  'EZK' => { match: /^eze/, name: 'Ezechiel' },
42
36
  'DAN' => { match: /^dan/, name: 'Daniel' },
43
37
  'HOS' => { match: /^oze/, name: 'Ozeáš' },
44
38
  'JOL' => { match: /^joe?l/, name: 'Joel' },
45
39
  'AMO' => { match: /^amo/, name: 'Amos' },
46
- 'OBA' => { match: /^ab/, name: 'Abdiáš' },
40
+ 'OBA' => { match: /^abd/, name: 'Abdiáš' },
47
41
  'JON' => { match: /^jona?/, name: 'Jonáš' },
48
42
  'MIC' => { match: /^mi/, name: 'Micheáš' },
49
43
  'NAM' => { match: /^na(h|m)/, name: 'Nahum' },
@@ -53,30 +47,30 @@ module BibleRef
53
47
  'ZEC' => { match: /^zac/, name: 'Zachariáš' },
54
48
  'MAL' => { match: /^mal/, name: 'Malachiáš' },
55
49
  'MAT' => { match: /^ma?t/, name: 'Matouš' },
56
- 'MRK' => { match: /^ma?rk/, name: 'Marek' },
50
+ 'MRK' => { match: /^ma?re?k/, name: 'Marek' },
57
51
  'LUK' => { match: /^lu?k/, name: 'Lukáš' },
58
52
  'JHN' => { match: /^j(an|n)/, name: 'Jan' },
59
53
  'ACT' => { match: /^sku/, name: 'Skutky' },
60
- 'ROM' => { match: /^rim/, name: 'Římanům' },
61
- '1CO' => { match: /^1 ?kor/, name: '1. Korintským' },
62
- '2CO' => { match: /^2 ?kor/, name: '2. Korintským' },
54
+ 'ROM' => { match: /^rim|^řím/, name: 'Římanům' },
55
+ '1CO' => { match: /^1\.? ?kor/, name: '1. Korintským' },
56
+ '2CO' => { match: /^2\.? ?kor/, name: '2. Korintským' },
63
57
  'GAL' => { match: /^gal/, name: 'Galatským' },
64
58
  'EPH' => { match: /^ef/, name: 'Efeským' },
65
59
  'PHP' => { match: /^filip/, name: 'Filipským' },
66
60
  'COL' => { match: /^kol/, name: 'Koloským' },
67
- '1TH' => { match: /^1 ?tes/, name: '1. Tesalonickým' },
68
- '2TH' => { match: /^2 ?tes/, name: '2. Tesalonickým' },
69
- '1TI' => { match: /^1 ?tim/, name: '1. Timoteovi' },
70
- '2TI' => { match: /^2 ?tim/, name: '2. Timoteovi' },
61
+ '1TH' => { match: /^1\.? ?tes/, name: '1. Tesalonickým' },
62
+ '2TH' => { match: /^2\.? ?tes/, name: '2. Tesalonickým' },
63
+ '1TI' => { match: /^1\.? ?tim/, name: '1. Timoteovi' },
64
+ '2TI' => { match: /^2\.? ?tim/, name: '2. Timoteovi' },
71
65
  'TIT' => { match: /^tit/, name: 'Titovi' },
72
66
  'PHM' => { match: /^fil/, name: 'Filemonovi' },
73
- 'HEB' => { match: /^zid/, name: 'Židům' },
67
+ 'HEB' => { match: /^[žz]id/, name: 'Židům' },
74
68
  'JAS' => { match: /^jak/, name: 'Jakub' },
75
- '1PE' => { match: /^1 ?pet/, name: '1. Petr' },
76
- '2PE' => { match: /^2 ?pet/, name: '2. Petr' },
77
- '1JN' => { match: /^1 ?jan/, name: '1. Jan' },
78
- '2JN' => { match: /^2 ?jan/, name: '2. Jan"' },
79
- '3JN' => { match: /^3 ?jan/, name: '3. Jan' },
69
+ '1PE' => { match: /^1\.? ?pet/, name: '1. Petr' },
70
+ '2PE' => { match: /^2\.? ?pet/, name: '2. Petr' },
71
+ '1JN' => { match: /^1\.? ?jan/, name: '1. Jan' },
72
+ '2JN' => { match: /^2\.? ?jan/, name: '2. Jan' },
73
+ '3JN' => { match: /^3\.? ?jan/, name: '3. Jan' },
80
74
  'JUD' => { match: /^(jud|juda)$/, name: 'Juda' },
81
75
  'REV' => { match: /^zj(e)?/, name: 'Zjevení' }
82
76
  }
@@ -4,12 +4,6 @@ require_relative 'base'
4
4
  module BibleRef
5
5
  module Languages
6
6
  class English < Base
7
- # Is it a single chapter book?
8
- def has_single_chapter?(reference)
9
- matches = [/^ob/, /^(jud|jd|jude)\b/, /^2 ?jo?h?n/, /^3 ?jo?h?n/, /^(philem|phm|pm)/]
10
- return Regexp.union(matches).match?(reference.downcase)
11
- end
12
-
13
7
  def books
14
8
  {
15
9
  'GEN' => { match: /^gen/, name: 'Genesis' },
@@ -4,12 +4,6 @@ require_relative 'base'
4
4
  module BibleRef
5
5
  module Languages
6
6
  class Latin < Base
7
- # Is it a single chapter book?
8
- def has_single_chapter?(reference)
9
- matches = ['Abdias', 'ad Philemonem', 'Joannis II', 'Joannis III', 'Judæ']
10
- return matches.any? { |e| reference.include?(e) }
11
- end
12
-
13
7
  def books
14
8
  {
15
9
  'GEN' => { name: 'Genesis' },
@@ -4,13 +4,6 @@ require_relative 'base'
4
4
  module BibleRef
5
5
  module Languages
6
6
  class Portuguese < Base
7
-
8
- # Is it a single chapter book?
9
- def has_single_chapter?(reference)
10
- matches = [/^ob/, /^jud/, /^2 jo/, /^3 jo/, /^fil/]
11
- return Regexp.union(matches).match?(reference.downcase)
12
- end
13
-
14
7
  def books
15
8
  {
16
9
  'GEN' => { match: /^g[eê]n/, name: 'Gênesis' },
@@ -19,7 +12,7 @@ module BibleRef
19
12
  'NUM' => { match: /^n[uú]/, name: 'Números' },
20
13
  'DEU' => { match: /^de?ut/, name: 'Deuteronômio' },
21
14
  'JOS' => { match: /^jos/, name: 'Josué' },
22
- 'JDG' => { match: /^ju/, name: 'Juízes' },
15
+ 'JDG' => { match: /^juí|^jz/, name: 'Juízes' },
23
16
  'RUT' => { match: /^ru/, name: 'Rute' },
24
17
  '1SA' => { match: /^1 sa?m/, name: '1 Samuel' },
25
18
  '2SA' => { match: /^2 sa?m/, name: '2 Samuel' },
@@ -62,7 +55,7 @@ module BibleRef
62
55
  '2CO' => { match: /^2 cor/, name: '2 Coríntios' },
63
56
  'GAL' => { match: /^g[aá]l/, name: 'Gálatas' },
64
57
  'EPH' => { match: /^ef[eé]/, name: 'Efésios' },
65
- 'PHP' => { match: /^fil/, name: 'Filipenses' },
58
+ 'PHP' => { match: /^fp|^filip/, name: 'Filipenses' },
66
59
  'COL' => { match: /^col/, name: 'Colossenses' },
67
60
  '1TH' => { match: /^1 te?s/, name: '1 Tessalonicenses' },
68
61
  '2TH' => { match: /^2 te?s/, name: '2 Tessalonicenses' },
@@ -4,13 +4,6 @@ require_relative 'base'
4
4
  module BibleRef
5
5
  module Languages
6
6
  class Romanian < Base
7
-
8
- # Is it a single chapter book?
9
- def has_single_chapter?(reference)
10
- matches = [/^ob/, /^iud/, /^2 io/, /^3 io/, /^fil/]
11
- return Regexp.union(matches).match?(reference.downcase)
12
- end
13
-
14
7
  def books
15
8
  {
16
9
  'GEN' => { match: /^gen/, name: 'Geneza' },
@@ -23,8 +16,8 @@ module BibleRef
23
16
  'RUT' => { match: /^ru/, name: 'Rut' },
24
17
  '1SA' => { match: /^1 sa?m/, name: '1 Samuel' },
25
18
  '2SA' => { match: /^2 sa?m/, name: '2 Samuel' },
26
- '1KI' => { match: /^1 [iîÎ]/, name: '1 Împăraţi' },
27
- '2KI' => { match: /^2 [iîÎ]/, name: '2 Împăraţi' },
19
+ '1KI' => { match: /^1 [iîÎ]mp/, name: '1 Împăraţi' },
20
+ '2KI' => { match: /^2 [iîÎ]mp/, name: '2 Împăraţi' },
28
21
  '1CH' => { match: /^1 cr/, name: '1 Cronici' },
29
22
  '2CH' => { match: /^2 cr/, name: '2 Cronici' },
30
23
  'EZR' => { match: /^ezr/, name: 'Ezra' },
@@ -34,7 +27,7 @@ module BibleRef
34
27
  'PSA' => { match: /^ps/, name: 'Psalmii' },
35
28
  'PRO' => { match: /^pr/, name: 'Proverbe' },
36
29
  'ECC' => { match: /^ecl/, name: 'Eclesiastul' },
37
- 'SNG' => { match: /^c[aâ]n$/, name: 'Cântarea cântărilor' },
30
+ 'SNG' => { match: /^c[aâ]n/, name: 'Cântarea cântărilor' },
38
31
  'ISA' => { match: /^isa/, name: 'Isaia' },
39
32
  'JER' => { match: /^ier/, name: 'Ieremia' },
40
33
  'LAM' => { match: /^plâ/, name: 'Plângerile lui Ieremia'},
@@ -62,7 +55,7 @@ module BibleRef
62
55
  '2CO' => { match: /^2 cor/, name: '2 Corinteni' },
63
56
  'GAL' => { match: /^gal/, name: 'Galateni' },
64
57
  'EPH' => { match: /^ef/, name: 'Efeseni' },
65
- 'PHP' => { match: /^fil/, name: 'Filipeni' },
58
+ 'PHP' => { match: /^flp|^filip/, name: 'Filipeni' },
66
59
  'COL' => { match: /^col/, name: 'Coloseni' },
67
60
  '1TH' => { match: /^1 te?s/, name: '1 Tesaloniceni' },
68
61
  '2TH' => { match: /^2 te?s/, name: '2 Tesaloniceni' },
@@ -76,7 +69,7 @@ module BibleRef
76
69
  '2PE' => { match: /^2 pet/, name: '2 Petru' },
77
70
  '1JN' => { match: /^1 io/, name: '1 Ioan' },
78
71
  '2JN' => { match: /^2 io/, name: '2 Ioan' },
79
- '3JN' => { match: /^3 io/, name: '1 Ioan' },
72
+ '3JN' => { match: /^3 io/, name: '3 Ioan' },
80
73
  'JUD' => { match: /^iud/, name: 'Iuda' },
81
74
  'REV' => { match: /^apo/, name: 'Apocalipsa' }
82
75
  }
@@ -4,12 +4,6 @@ require_relative 'base'
4
4
  module BibleRef
5
5
  module Languages
6
6
  class Russian < Base
7
- # Is it a single chapter book?
8
- def has_single_chapter?(reference)
9
- matches = [/^авд(и[йя])?/, /^иуды?/, /^2 ?и(оа)?нн?а?/, /^3 ?и(оа)?нн?а?/, /^ф(лм|ил(имон)?у?)/]
10
- return Regexp.union(matches).match?(reference.downcase)
11
- end
12
-
13
7
  def books
14
8
  {
15
9
  'GEN' => { match: /^быт(и[её])?/, name: 'Бытие' }, # Быт, Бытие
@@ -24,7 +18,7 @@ module BibleRef
24
18
  '2SA' => { match: /^2 ?(цар(ств)?|сам(уила?)?)/, name: '2 Царств' }, # 2 Цар, 2 Царств, 2 Сам, 2 Самуила
25
19
  '1KI' => { match: /^3 ?цар(ств)?/, name: '3 Царств' }, # 3 Цар, 3 Царств
26
20
  '2KI' => { match: /^4 ?цар(ств)?/, name: '4 Царств' }, # 4 Цар, 4 Царств
27
- '1CH' => { match: /^2 ?пар(алипоменон)/, name: '1 Паралипоменон' }, # 1 Пар, 1 Паралипоменон
21
+ '1CH' => { match: /^1 ?пар(алипоменон)/, name: '1 Паралипоменон' }, # 1 Пар, 1 Паралипоменон
28
22
  '2CH' => { match: /^2 ?пар(алипоменон)/, name: '2 Паралипоменон' }, # 2 Пар, 2 Паралипоменон
29
23
  'EZR' => { match: /^езд(р[аы])?/, name: 'Ездра' }, # Ездр, Ездра, Ездры
30
24
  'NEH' => { match: /^неем(и[яи])?/, name: 'Неемия' }, # Неем, Неемия, Неемии
@@ -82,14 +76,14 @@ module BibleRef
82
76
  '2CO' => { match: /^2 ?кор(инфянам)?/, name: '2 Коринфянам' }, # 2 Кор, 2 Коринфянам
83
77
  'GAL' => { match: /^гал(атам)?/, name: 'Галатам' }, # Гал, Галатам
84
78
  'EPH' => { match: /^[еэ]ф(есянам)?/, name: 'Ефесянам' }, # Еф, Ефесянам
85
- 'PHP' => { match: /^флп/, name: 'Филиппийцам' }, # Флп, Филиппийцам
79
+ 'PHP' => { match: /^флп|^Филип/, name: 'Филиппийцам' }, # Флп, Филиппийцам
86
80
  'COL' => { match: /^кол(оссянам)?/, name: 'Колоссянам' }, # Кол, Колоссянам
87
81
  '1TH' => { match: /^1 ?фес(с(алоникийцам)?)?/,name: '1 Фессалоникийцам' }, # 1 Фес, 1 Фессалоникийцам
88
82
  '2TH' => { match: /^2 ?фес(с(алоникийцам)?)?/,name: '2 Фессалоникийцам' }, # 2 Фес, 2 Фессалоникийцам
89
83
  '1TI' => { match: /^1 ?тим(офею)?/, name: '1 Тимофею' }, # 1 Тим, 1 Тимофею
90
84
  '2TI' => { match: /^2 ?тим(офею)?/, name: '2 Тимофею' }, # 2 Тим, 2 Тимофею
91
85
  'TIT' => { match: /^титу?/, name: 'Титу' }, # Тит, Титу
92
- 'PHM' => { match: /^флм/, name: 'Филимону' }, # Флм, Филимону
86
+ 'PHM' => { match: /^флм|^Филим/, name: 'Филимону' }, # Флм, Филимону
93
87
  'HEB' => { match: /^евр(еям)?/, name: 'Евреям' }, # Евр, Евреям
94
88
  'JAS' => { match: /^иак(ова?)?/, name: 'Иакова' }, # Иак, Иаков, Иакова
95
89
  '1PE' => { match: /^1 ?пет(ра?)?/, name: '1 Петра' }, # 1 Пет, 1 Петра
@@ -23,13 +23,13 @@ module BibleRef
23
23
  rule(:ref_range) { (ref.as(:from) >> str("-") >> (ref | verse).as(:to)).as(:range) }
24
24
  rule(:verse_range) { (verse.as(:from) >> str("-") >> verse.as(:to)).as(:range) }
25
25
 
26
- rule(:ref) { (chapter >> str(":") >> verse) }
26
+ rule(:ref) { chapter >> str(":") >> verse }
27
27
 
28
28
  rule(:chapters) { (chapter >> (match("[-,]") >> chapter).repeat).as(:refs) }
29
29
  rule(:chapter) { num.as(:chapter) }
30
30
  rule(:verse) { num.as(:verse) }
31
31
 
32
- rule(:word) { (match("[123]").maybe >> match("[^0-9]").repeat(1)).as(:word) }
32
+ rule(:word) { (match("[1234]").maybe >> match("[^0-9]").repeat(1)).as(:word) }
33
33
  rule(:separator) { (str(",") >> space.maybe) | (space.maybe >> str("&") >> space.maybe) }
34
34
  rule(:num) { match("[0-9]").repeat(1).as(:num) }
35
35
  rule(:space) { str(" ").repeat(1) }
@@ -13,8 +13,8 @@ module BibleRef
13
13
  @reference = reference
14
14
  @single_chapter_book_matching = single_chapter_book_matching
15
15
  raise 'expected :special or :indifferent' unless %i[special indifferent].include?(@single_chapter_book_matching)
16
- standardize_reference
17
16
  @details = parse
17
+ standardize_single_chapter_book
18
18
  end
19
19
 
20
20
  # Returns an array of pairs, each one being the from and to for a range.
@@ -25,11 +25,15 @@ module BibleRef
25
25
  def ranges
26
26
  return nil unless valid?
27
27
  @chapter = nil
28
- [@details[:refs]].flatten.map do |ref|
28
+ refs_as_array.map do |ref|
29
29
  normalize_range(ref) || normalize_ref(ref)
30
30
  end
31
31
  end
32
32
 
33
+ def refs_as_array
34
+ [@details[:refs]].flatten
35
+ end
36
+
33
37
  # Returns a USFX-compatible book id, or nil if book is unknown.
34
38
  def book_id
35
39
  return nil unless @details
@@ -77,20 +81,19 @@ module BibleRef
77
81
  end
78
82
  end
79
83
 
80
- def standardize_reference
81
- standardize_single_chapter_book if @language.has_single_chapter?(@reference)
82
- end
83
-
84
84
  def standardize_single_chapter_book
85
85
  return if @single_chapter_book_matching == :indifferent
86
86
  return @reference if @reference.include? ':'
87
+ return unless %w[OBA PHM 2JN 3JN JUD].include?(book_id)
88
+ return if refs_as_array.any? { |r| r[:verse] }
87
89
 
88
90
  matches = @reference.match(/^([\d]?[\D\s]*)/)
89
- return @reference if matches.length() == 0
91
+ #return @reference if matches.length() == 0
90
92
 
91
93
  book = matches[0].strip
92
94
  requested = @reference.sub(book, '').strip
93
95
  @reference = "#{book} 1:#{requested}"
96
+ @details = parse
94
97
  end
95
98
 
96
99
  def parse
@@ -1,3 +1,3 @@
1
1
  module BibleRef
2
- VERSION = '1.9.1'
2
+ VERSION = '2.0.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bible_ref
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Morgan