bible_passage 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2890015cc6e51a46177e9e7dc6f131f2daec409
4
- data.tar.gz: 50b062cb7d4499675abf699a40c0b9deb3585663
3
+ metadata.gz: d0d060820ac80371fe54229c46beec5443be4e07
4
+ data.tar.gz: 8e3ec529df1b52a857d19873c32e2f11528e8b8b
5
5
  SHA512:
6
- metadata.gz: c815414126bb75713b3c06229612821e0db8f1708d80a672e5ced7910ba8d86d91fb9c5cfcc684ec009d6a3e6ecd4a66543ceda5e4086f1ce9912b464c6a1ee0
7
- data.tar.gz: 139fb3f61289da76d82f148810c70254c8f365bf5e3b2a6f8b91fb624eec9a50dd7574a62b5fb54550e27e7c5ec652b10aa43e58e82b361e8ee43bddbc84165d
6
+ metadata.gz: 4a1729dacde81b0a0518d6b0350789de1cfc9e6c7d47677e014a4d0b7b3c561230fdf89803e05eb14c597d12f95a74be947ad40e3dd922f3d8f788daf283ed8e
7
+ data.tar.gz: b381414c701376ab6d2b6cf9f25b337124f4583df0f7843092ddaa7c9efff43a52515ed8cedc5e32d345a29f1f809ce992da07efdeaaa21035b607457e603106
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'bible_passage'
3
3
  s.summary = 'A simple library for parsing and rendering bible passages'
4
- s.version = '0.2.3'
4
+ s.version = '0.2.4'
5
5
  s.authors = ["Si Wilkins"]
6
6
  s.email = 'si.wilkins@gmail.com'
7
7
  s.homepage = 'https://github.com/siwilkins/bible_passage'
@@ -3,336 +3,76 @@ module BiblePassage
3
3
  class BookKeyTranslator
4
4
 
5
5
  TRANSLATIONS = {
6
- ge: :gen,
7
- gen: :gen,
8
- gene: :gen,
9
- genes: :gen,
10
- genesis: :gen,
11
- gn: :gen,
12
-
13
- ex: :exod,
14
- exo: :exod,
15
- exod: :exod,
16
- exodus: :exod,
17
-
18
- le: :lev,
19
- lev: :lev,
20
- levit: :lev,
21
- leviticus: :lev,
22
-
23
- nm: :num,
24
- nu: :num,
25
- num: :num,
26
- numb: :num,
27
- numbers: :num,
28
-
29
- de: :deut,
30
- de: :deut,
31
- deu: :deut,
32
- deut: :deut,
33
- deuter: :deut,
34
- deuteronomy: :deut,
35
- dt: :deut,
36
-
37
- jos: :josh,
38
- josh: :josh,
39
- joshua: :josh,
40
-
41
- jd: :judg,
42
- jdg: :judg,
43
- judg: :judg,
44
- judges: :judg,
45
-
46
- ruth: :ruth,
47
-
48
- '1 sa'.to_sym => '1sam'.to_sym,
49
- '1 sam'.to_sym => '1sam'.to_sym,
50
- '1 samuel'.to_sym => '1sam'.to_sym,
51
-
52
- '2 sa'.to_sym => '2sam'.to_sym,
53
- '2 sam'.to_sym => '2sam'.to_sym,
54
- '2 samuel'.to_sym => '2sam'.to_sym,
55
-
56
- '1 kgs'.to_sym => '1kings'.to_sym,
57
- '1 ki'.to_sym => '1kings'.to_sym,
58
- '1 king'.to_sym => '1kings'.to_sym,
59
- '1 kings'.to_sym => '1kings'.to_sym,
60
- '1 kngs'.to_sym => '1kings'.to_sym,
61
-
62
- '2 kgs'.to_sym => '2kings'.to_sym,
63
- '2 ki'.to_sym => '2kings'.to_sym,
64
- '2 king'.to_sym => '2kings'.to_sym,
65
- '2 kings'.to_sym => '2kings'.to_sym,
66
- '2 kngs'.to_sym => '2kings'.to_sym,
67
-
68
- '1 ch'.to_sym => '1chr'.to_sym,
69
- '1 chr'.to_sym => '1chr'.to_sym,
70
- '1 chro'.to_sym => '1chr'.to_sym,
71
- '1 chron'.to_sym => '1chr'.to_sym,
72
- '1 chronicles'.to_sym => '1chr'.to_sym,
73
-
74
- '2 ch'.to_sym => '2chr'.to_sym,
75
- '2 chr'.to_sym => '2chr'.to_sym,
76
- '2 chro'.to_sym => '2chr'.to_sym,
77
- '2 chron'.to_sym => '2chr'.to_sym,
78
- '2 chronicles'.to_sym => '2chr'.to_sym,
79
-
80
- ezr: :ezra,
81
- ezra: :ezra,
82
-
83
- ne: :neh,
84
- neh: :neh,
85
- nehem: :neh,
86
- nehemiah: :neh,
87
-
88
- es: :esth,
89
- est: :esth,
90
- esth: :esth,
91
- esther: :esth,
92
-
93
- jo: :job,
94
- job: :job,
95
-
96
- ps: :ps,
97
- psa: :ps,
98
- psal: :ps,
99
- psalm: :ps,
100
- psalms: :ps,
101
-
102
- pr: :prov,
103
- pro: :prov,
104
- prov: :prov,
105
- proverbs: :prov,
106
-
107
- ec: :eccl,
108
- ecc: :eccl,
109
- eccl: :eccl,
110
- eccles: :eccl,
111
- ecclesiastes: :eccl,
112
-
113
- so: :song,
114
- 'song of solomon'.to_sym => :song,
115
- 'song of songs'.to_sym => :song,
116
- 'song of sol'.to_sym => :song,
117
- ss: :song,
118
- ssong: :song,
119
-
120
- is: :isa,
121
- isa: :isa,
122
- isaiah: :isa,
123
-
124
- je: :jer,
125
- jer: :jer,
126
- jere: :jer,
127
- jerem: :jer,
128
- jeremiah: :jer,
129
-
130
- la: :lam,
131
- lam: :lam,
132
- lamen: :lam,
133
- lament: :lam,
134
- lamentations: :lam,
135
-
136
- eze: :ezek,
137
- ezek: :ezek,
138
- ezekiel: :ezek,
139
-
140
- da: :dan,
141
- dan: :dan,
142
- daniel: :dan,
143
-
144
- ho: :hos,
145
- hos: :hos,
146
- hosea: :hos,
147
-
148
- joe: :joel,
149
- joel: :joel,
150
-
151
- am: :amos,
152
- amos: :amos,
153
-
154
- ob: :obad,
155
- oba: :obad,
156
- obad: :obad,
157
- obadiah: :obad,
158
-
159
- jon: :jonah,
160
- jona: :jonah,
161
- jonah: :jonah,
162
-
163
- mi: :mic,
164
- mic: :mic,
165
- micah: :mic,
166
-
167
- na: :nah,
168
- nah: :nah,
169
- nahum: :nah,
170
-
171
- hab: :hab,
172
- habak: :hab,
173
- habakkuk: :hab,
174
-
175
- zep: :zeph,
176
- zeph: :zeph,
177
- zephaniah: :zeph,
178
-
179
- hag: :hag,
180
- hagg: :hag,
181
- haggai: :hag,
182
-
183
- zec: :zech,
184
- zech: :zech,
185
- zechariah: :zech,
186
-
187
- mal: :mal,
188
- malac: :mal,
189
- malach: :mal,
190
- malachi: :mal,
191
-
192
- mat: :matt,
193
- matt: :matt,
194
- matth: :matt,
195
- matthew: :matt,
196
- mt: :matt,
197
-
198
- mar: :mark,
199
- mark: :mark,
200
- mr: :mark,
201
- mrk: :mark,
202
-
203
- lk: :luke,
204
- lke: :luke,
205
- lu: :luke,
206
- luk: :luke,
207
- luke: :luke,
208
-
209
- jhn: :john,
210
- jn: :john,
211
- joh: :john,
212
- john: :john,
213
-
214
- ac: :acts,
215
- act: :acts,
216
- acts: :acts,
217
-
218
- ro: :rom,
219
- rom: :rom,
220
- roman: :rom,
221
- romans: :rom,
222
-
223
- '1 co'.to_sym => '1cor'.to_sym,
224
- '1 cor'.to_sym => '1cor'.to_sym,
225
- '1 corin'.to_sym => '1cor'.to_sym,
226
- '1 corinth'.to_sym => '1cor'.to_sym,
227
- '1 corinthians'.to_sym => '1cor'.to_sym,
228
-
229
- '2 co'.to_sym => '2cor'.to_sym,
230
- '2 cor'.to_sym => '2cor'.to_sym,
231
- '2 corin'.to_sym => '2cor'.to_sym,
232
- '2 corinth'.to_sym => '2cor'.to_sym,
233
- '2 corinthians'.to_sym => '2cor'.to_sym,
234
-
235
- ga: :gal,
236
- gal: :gal,
237
- galat: :gal,
238
- galatians: :gal,
239
-
240
- ep: :eph,
241
- eph: :eph,
242
- ephes: :eph,
243
- ephesians: :eph,
244
-
245
- ph: :phil,
246
- phi: :phil,
247
- phil: :phil,
248
- phili: :phil,
249
- philip: :phil,
250
- philipp: :phil,
251
- philippians: :phil,
252
- php: :phil,
253
-
254
- co: :col,
255
- col: :col,
256
- colo: :col,
257
- colos: :col,
258
- coloss: :col,
259
- colossians: :col,
260
-
261
- '1 ti'.to_sym => '1tim'.to_sym,
262
- '1 tim'.to_sym => '1tim'.to_sym,
263
- '1 timothy'.to_sym => '1tim'.to_sym,
264
-
265
- '1 th'.to_sym => '1thess'.to_sym,
266
- '1 the'.to_sym => '1thess'.to_sym,
267
- '1 thes'.to_sym => '1thess'.to_sym,
268
- '1 thess'.to_sym => '1thess'.to_sym,
269
- '1 thessalonians'.to_sym => '1thess'.to_sym,
270
-
271
- '2 th'.to_sym => '2thess'.to_sym,
272
- '2 the'.to_sym => '2thess'.to_sym,
273
- '2 thes'.to_sym => '2thess'.to_sym,
274
- '2 thess'.to_sym => '2thess'.to_sym,
275
- '2 thessalonians'.to_sym => '2thess'.to_sym,
276
-
277
- '2 ti'.to_sym => '2tim'.to_sym,
278
- '2 tim'.to_sym => '2tim'.to_sym,
279
- '2 timothy'.to_sym => '2tim'.to_sym,
280
-
281
- tit: :titus,
282
- titu: :titus,
283
- titus: :titus,
284
-
285
- phile: :phlm,
286
- philem: :phlm,
287
- philemon: :phlm,
288
- phlm: :phlm,
289
- phlmn: :phlm,
290
- phm: :phlm,
291
- phmn: :phlm,
292
-
293
- he: :heb,
294
- heb: :heb,
295
- hebr: :heb,
296
- hebrews: :heb,
297
-
298
- ja: :jas,
299
- jam: :jas,
300
- james: :jas,
301
- jas: :jas,
302
-
303
- '1 pe'.to_sym => '1pet'.to_sym,
304
- '1 pet'.to_sym => '1pet'.to_sym,
305
- '1 peter'.to_sym => '1pet'.to_sym,
306
-
307
- '2 pe'.to_sym => '2pet'.to_sym,
308
- '2 pet'.to_sym => '2pet'.to_sym,
309
- '2 peter'.to_sym => '2pet'.to_sym,
310
-
311
- '1 jn'.to_sym => '1john'.to_sym,
312
- '1 jo'.to_sym => '1john'.to_sym,
313
- '1 joh'.to_sym => '1john'.to_sym,
314
- '1 john'.to_sym => '1john'.to_sym,
315
-
316
- '2 jn'.to_sym => '2john'.to_sym,
317
- '2 jo'.to_sym => '2john'.to_sym,
318
- '2 joh'.to_sym => '2john'.to_sym,
319
- '2 john'.to_sym => '2john'.to_sym,
320
-
321
- '3 jn'.to_sym => '3john'.to_sym,
322
- '3 jo'.to_sym => '3john'.to_sym,
323
- '3 joh'.to_sym => '3john'.to_sym,
324
- '3 john'.to_sym => '3john'.to_sym,
325
-
326
- jude: :jude,
327
-
328
- re: :rev,
329
- rev: :rev,
330
- revel: :rev,
331
- revelation: :rev,
6
+ gen: [:ge, :gen, :gene, :genes, :genesis, :gn],
7
+ exod: [:ex, :exo, :exod, :exodus],
8
+ lev: [:le, :lev, :levit, :leviticus],
9
+ num: [:nm, :nu, :num, :numb, :numbers],
10
+ deut: [:de, :deu, :deut, :deuter, :deuteronomy, :dt],
11
+ josh: [:jos, :josh, :joshua],
12
+ judg: [:jd, :jdg, :judg, :judges],
13
+ ruth: [:ruth],
14
+ :"1sam" => [:"1 sa", :"1 sam", :"1 samuel"],
15
+ :"2sam" => [:"2 sa", :"2 sam", :"2 samuel"],
16
+ :"1kings" => [:"1 kgs", :"1 ki", :"1 king", :"1 kings", :"1 kngs"],
17
+ :"2kings" => [:"2 kgs", :"2 ki", :"2 king", :"2 kings", :"2 kngs"],
18
+ :"1chr" => [:"1 ch", :"1 chr", :"1 chro", :"1 chron", :"1 chronicles"],
19
+ :"2chr" => [:"2 ch", :"2 chr", :"2 chro", :"2 chron", :"2 chronicles"],
20
+ ezra: [:ezr, :ezra],
21
+ neh: [:ne, :neh, :nehem, :nehemiah],
22
+ esth: [:es, :est, :esth, :esther],
23
+ job: [:jo, :job],
24
+ ps: [:ps, :psa, :psal, :psalm, :psalms],
25
+ prov: [:pr, :pro, :prov, :proverbs],
26
+ eccl: [:ec, :ecc, :eccl, :eccles, :ecclesiastes],
27
+ song: [:so, :"song of solomon", :"song of songs", :"song of sol", :ss, :ssong],
28
+ isa: [:is, :isa, :isaiah],
29
+ jer: [:je, :jer, :jere, :jerem, :jeremiah],
30
+ lam: [:la, :lam, :lamen, :lament, :lamentations],
31
+ ezek: [:eze, :ezek, :ezekiel],
32
+ dan: [:da, :dan, :daniel],
33
+ hos: [:ho, :hos, :hosea],
34
+ joel: [:joe, :joel],
35
+ amos: [:am, :amos],
36
+ obad: [:ob, :oba, :obad, :obadiah],
37
+ jonah: [:jon, :jona, :jonah],
38
+ mic: [:mi, :mic, :micah],
39
+ nah: [:na, :nah, :nahum],
40
+ hab: [:hab, :habak, :habakkuk],
41
+ zeph: [:zep, :zeph, :zephaniah],
42
+ hag: [:hag, :hagg, :haggai],
43
+ zech: [:zec, :zech, :zechariah],
44
+ mal: [:mal, :malac, :malach, :malachi],
45
+ matt: [:mat, :matt, :matth, :matthew, :mt],
46
+ mark: [:mar, :mark, :mr, :mrk],
47
+ luke: [:lk, :lke, :lu, :luk, :luke],
48
+ john: [:jhn, :jn, :joh, :john],
49
+ acts: [:ac, :act, :acts],
50
+ rom: [:ro, :rom, :roman, :romans],
51
+ :"1cor" => [:"1 co", :"1 cor", :"1 corin", :"1 corinth", :"1 corinthians"],
52
+ :"2cor" => [:"2 co", :"2 cor", :"2 corin", :"2 corinth", :"2 corinthians"],
53
+ gal: [:ga, :gal, :galat, :galatians],
54
+ eph: [:ep, :eph, :ephes, :ephesians],
55
+ phil: [:ph, :phi, :phil, :phili, :philip, :philipp, :philippians, :php],
56
+ col: [:co, :col, :colo, :colos, :coloss, :colossians],
57
+ :"1tim" => [:"1 ti", :"1 tim", :"1 timothy"],
58
+ :"2tim" => [:"2 ti", :"2 tim", :"2 timothy"],
59
+ :"1thess" => [:"1 th", :"1 the", :"1 thes", :"1 thess", :"1 thessalonians"],
60
+ :"2thess" => [:"2 th", :"2 the", :"2 thes", :"2 thess", :"2 thessalonians"],
61
+ titus: [:tit, :titu, :titus],
62
+ phlm: [:phile, :philem, :philemon, :phlm, :phlmn, :phm, :phmn],
63
+ heb: [:he, :heb, :hebr, :hebrews],
64
+ jas: [:ja, :jam, :james, :jas],
65
+ :"1pet" => [:"1 pe", :"1 pet", :"1 peter"],
66
+ :"2pet" => [:"2 pe", :"2 pet", :"2 peter"],
67
+ :"1john" => [:"1 jn", :"1 jo", :"1 joh", :"1 john"],
68
+ :"2john" => [:"2 jn", :"2 jo", :"2 joh", :"2 john"],
69
+ :"3john" => [:"3 jn", :"3 jo", :"3 joh", :"3 john"],
70
+ jude: [:jude],
71
+ rev: [:re, :rev, :revel, :revelation]
332
72
  }
333
73
 
334
74
  def keyify(book_name, raise_errors = true)
335
- translation = TRANSLATIONS[normalize_input(book_name)]
75
+ translation = BookKeyTranslator.translations[normalize_input(book_name)]
336
76
  if translation
337
77
  return translation
338
78
  elsif raise_errors
@@ -345,6 +85,14 @@ module BiblePassage
345
85
  book_name.strip.downcase.gsub(/\s+/, ' ').to_sym
346
86
  end
347
87
 
88
+ def self.translations
89
+ @@translations ||= Hash[
90
+ TRANSLATIONS.flat_map do |book, abbrevs|
91
+ abbrevs.map do |abbrev|
92
+ [abbrev, book]
93
+ end
94
+ end
95
+ ]
96
+ end
348
97
  end
349
-
350
98
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bible_passage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Si Wilkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-20 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec