rcv_deeplink 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 733ff8a1087f5f4f51bc84aa2b6dd4107bdfe47d219116ca00377aa83b34b271
4
+ data.tar.gz: dbbfb5bab2636992b9a199aebd8f6517fcc276eaebf30da97055b3489e31656f
5
+ SHA512:
6
+ metadata.gz: 6a63926d1935028dc73ce05dc1e5622dae2a17a9ac40edaa500ebbfdc6d19d28cb81a8f259ef93632fcc4261ed66c86a87ae1a6bef67d8a8de4226bc554d57e8
7
+ data.tar.gz: 6084bfa1d995575fc26dfb1947e8665247b6711270e65bf049b56b9bc13b48d1a5fd6cb70b1e21a8932c0e0e00a9d8d223548cc8262b941a28627f56e1b90d00
@@ -0,0 +1,70 @@
1
+ module Reference
2
+ MAPPING = [
3
+ { book_number: 1, book_name: 'Genesis', num_chapters: 50, abbreviation: 'Gen.', ref_code: 'Gen'},
4
+ { book_number: 2, book_name: 'Exodus', num_chapters: 40, abbreviation: 'Exo.', ref_code: 'Exo'},
5
+ { book_number: 3, book_name: 'Leviticus', num_chapters: 27, abbreviation: 'Lev.', ref_code: 'Lev'},
6
+ { book_number: 4, book_name: 'Numbers', num_chapters: 36, abbreviation: 'Num.', ref_code: 'Num'},
7
+ { book_number: 5, book_name: 'Deuteronomy', num_chapters: 34, abbreviation: 'Deut.', ref_code: 'Deu'},
8
+ { book_number: 6, book_name: 'Joshua', num_chapters: 24, abbreviation: 'Josh.', ref_code: 'Jos'},
9
+ { book_number: 7, book_name: 'Judges', num_chapters: 21, abbreviation: 'Judg.', ref_code: 'Jud'},
10
+ { book_number: 8, book_name: 'Ruth', num_chapters: 4, abbreviation: 'Ruth', ref_code: 'Rut'},
11
+ { book_number: 9, book_name: '1 Samuel', num_chapters: 31, abbreviation: '1 Sam.', ref_code: 'FSa'},
12
+ { book_number: 10, book_name: '2 Samuel', num_chapters: 24, abbreviation: '2 Sam.', ref_code: 'SSa'},
13
+ { book_number: 11, book_name: '1 Kings', num_chapters: 22, abbreviation: '1 Kings', ref_code: 'FKi'},
14
+ { book_number: 12, book_name: '2 Kings', num_chapters: 25, abbreviation: '2 Kings', ref_code: 'SKi'},
15
+ { book_number: 13, book_name: '1 Chronicles', num_chapters: 29, abbreviation: '1 Chron.', ref_code: 'FCh'},
16
+ { book_number: 14, book_name: '2 Chronicles', num_chapters: 36, abbreviation: '2 Chron.', ref_code: 'SCh'},
17
+ { book_number: 15, book_name: 'Ezra', num_chapters: 10, abbreviation: 'Ezra', ref_code: 'Ezr'},
18
+ { book_number: 16, book_name: 'Nehemiah', num_chapters: 13, abbreviation: 'Neh.', ref_code: 'Neh'},
19
+ { book_number: 17, book_name: 'Esther', num_chapters: 10, abbreviation: 'Esth.', ref_code: 'Est'},
20
+ { book_number: 18, book_name: 'Job', num_chapters: 42, abbreviation: 'Job', ref_code: 'Job'},
21
+ { book_number: 19, book_name: 'Psalms', num_chapters: 150, abbreviation: 'Psa.', ref_code: 'Psa'},
22
+ { book_number: 20, book_name: 'Proverbs', num_chapters: 31, abbreviation: 'Prov.', ref_code: 'Pro'},
23
+ { book_number: 21, book_name: 'Ecclesiastes', num_chapters: 12, abbreviation: 'Eccl.', ref_code: 'Ecc'},
24
+ { book_number: 22, book_name: 'Song of Solomon', num_chapters: 8, abbreviation: 'S.S.', ref_code: 'Son'},
25
+ { book_number: 23, book_name: 'Isaiah', num_chapters: 66, abbreviation: 'Isa.', ref_code: 'Isa'},
26
+ { book_number: 24, book_name: 'Jeremiah', num_chapters: 52, abbreviation: 'Jer.', ref_code: 'Jer'},
27
+ { book_number: 25, book_name: 'Lamentations', num_chapters: 5, abbreviation: 'Lam.', ref_code: 'Lam'},
28
+ { book_number: 26, book_name: 'Ezekiel', num_chapters: 48, abbreviation: 'Ezek.', ref_code: 'Eze'},
29
+ { book_number: 27, book_name: 'Daniel', num_chapters: 12, abbreviation: 'Dan.', ref_code: 'Dan'},
30
+ { book_number: 28, book_name: 'Hosea', num_chapters: 14, abbreviation: 'Hosea', ref_code: 'Hos'},
31
+ { book_number: 29, book_name: 'Joel', num_chapters: 3, abbreviation: 'Joel', ref_code: 'Joe'},
32
+ { book_number: 30, book_name: 'Amos', num_chapters: 9, abbreviation: 'Amos', ref_code: 'Amo'},
33
+ { book_number: 31, book_name: 'Obadiah', num_chapters: 1, abbreviation: 'Oba.', ref_code: 'Oba'},
34
+ { book_number: 32, book_name: 'Jonah', num_chapters: 4, abbreviation: 'Jonah', ref_code: 'Jon'},
35
+ { book_number: 33, book_name: 'Micah', num_chapters: 7, abbreviation: 'Micah', ref_code: 'Mic'},
36
+ { book_number: 34, book_name: 'Nahum', num_chapters: 3, abbreviation: 'Nahum', ref_code: 'Nah'},
37
+ { book_number: 35, book_name: 'Habakkuk', num_chapters: 3, abbreviation: 'Hab.', ref_code: 'Hab'},
38
+ { book_number: 36, book_name: 'Zephaniah', num_chapters: 3, abbreviation: 'Zeph.', ref_code: 'Zep'},
39
+ { book_number: 37, book_name: 'Haggai', num_chapters: 2, abbreviation: 'Hag.', ref_code: 'Hag'},
40
+ { book_number: 38, book_name: 'Zechariah', num_chapters: 14, abbreviation: 'Zech.', ref_code: 'Zec'},
41
+ { book_number: 39, book_name: 'Malachi', num_chapters: 4, abbreviation: 'Mal.', ref_code: 'Mal'},
42
+ { book_number: 40, book_name: 'Matthew', num_chapters: 28, abbreviation: 'Matt.', ref_code: 'Mat'},
43
+ { book_number: 41, book_name: 'Mark', num_chapters: 16, abbreviation: 'Mark', ref_code: 'Mar'},
44
+ { book_number: 42, book_name: 'Luke', num_chapters: 24, abbreviation: 'Luke', ref_code: 'Luk'},
45
+ { book_number: 43, book_name: 'John', num_chapters: 21, abbreviation: 'John', ref_code: 'Joh'},
46
+ { book_number: 44, book_name: 'Acts', num_chapters: 28, abbreviation: 'Acts', ref_code: 'Act'},
47
+ { book_number: 45, book_name: 'Romans', num_chapters: 16, abbreviation: 'Rom.', ref_code: 'Rom'},
48
+ { book_number: 46, book_name: '1 Corinthians', num_chapters: 16, abbreviation: '1 Cor.', ref_code: 'FCo'},
49
+ { book_number: 47, book_name: '2 Corinthians', num_chapters: 13, abbreviation: '2 Cor.', ref_code: 'SCo'},
50
+ { book_number: 48, book_name: 'Galatians', num_chapters: 6, abbreviation: 'Gal.', ref_code: 'Gal'},
51
+ { book_number: 49, book_name: 'Ephesians', num_chapters: 6, abbreviation: 'Eph.', ref_code: 'Eph'},
52
+ { book_number: 50, book_name: 'Philippians', num_chapters: 4, abbreviation: 'Phil.', ref_code: 'Phi'},
53
+ { book_number: 51, book_name: 'Colossians', num_chapters: 4, abbreviation: 'Col.', ref_code: 'Col'},
54
+ { book_number: 52, book_name: '1 Thessalonians', num_chapters: 5, abbreviation: '1 Thes.', ref_code: 'FTh'},
55
+ { book_number: 53, book_name: '2 Thessalonians', num_chapters: 3, abbreviation: '2 Thes.', ref_code: 'STh'},
56
+ { book_number: 54, book_name: '1 Timothy', num_chapters: 6, abbreviation: '1 Tim.', ref_code: 'FTi'},
57
+ { book_number: 55, book_name: '2 Timothy', num_chapters: 4, abbreviation: '2 Tim.', ref_code: 'STi'},
58
+ { book_number: 56, book_name: 'Titus', num_chapters: 3, abbreviation: 'Titus', ref_code: 'Tit'},
59
+ { book_number: 57, book_name: 'Philemon', num_chapters: 1, abbreviation: 'Philem.', ref_code: 'Phm'},
60
+ { book_number: 58, book_name: 'Hebrews', num_chapters: 13, abbreviation: 'Heb.', ref_code: 'Heb'},
61
+ { book_number: 59, book_name: 'James', num_chapters: 5, abbreviation: 'James', ref_code: 'Jam'},
62
+ { book_number: 60, book_name: '1 Peter', num_chapters: 5, abbreviation: '1 Pet.', ref_code: 'FPe'},
63
+ { book_number: 61, book_name: '2 Peter', num_chapters: 3, abbreviation: '2 Pet.', ref_code: 'SPe'},
64
+ { book_number: 62, book_name: '1 John', num_chapters: 5, abbreviation: '1 John', ref_code: 'FJo'},
65
+ { book_number: 63, book_name: '2 John', num_chapters: 1, abbreviation: '2 John', ref_code: 'SJo'},
66
+ { book_number: 64, book_name: '3 John', num_chapters: 1, abbreviation: '3 John', ref_code: 'TJo'},
67
+ { book_number: 65, book_name: 'Jude', num_chapters: 1, abbreviation: 'Jude', ref_code: 'Jde'},
68
+ { book_number: 66, book_name: 'Revelation', num_chapters: 22, abbreviation: 'Rev.', ref_code: 'Rev'}
69
+ ]
70
+ end
@@ -0,0 +1,65 @@
1
+ require 'rcv_deeplink/reference'
2
+
3
+ class RcvDeeplink
4
+
5
+ URL = "https://text.recoveryversion.bible/"
6
+
7
+ def self.url(book_number, chapter_number, verse_number=1)
8
+ self.new(book_number, chapter_number, verse_number).url
9
+ end
10
+
11
+ def self.path(book_number, chapter_number, verse_number=1)
12
+ self.new(book_number, chapter_number, verse_number).path
13
+ end
14
+
15
+ def initialize(book_number, chapter_number, verse_number)
16
+ @book_number = book_number
17
+ @chapter_number = chapter_number
18
+ @verse_number = verse_number
19
+ end
20
+
21
+ def path
22
+ "#{padded_book_number}_#{book_name_no_spaces}_#{@chapter_number}.htm\##{anchor_tag_book_abbreviation}#{@chapter_number}#{chapter_anchor_text}"
23
+ end
24
+
25
+ def url
26
+ URL + path
27
+ end
28
+
29
+ private
30
+
31
+ def padded_book_number
32
+ sprintf("%02d", @book_number.to_i)
33
+ end
34
+
35
+ def mapping
36
+ @mapping ||= Reference::MAPPING
37
+ end
38
+
39
+ def row
40
+ @row ||= mapping[@book_number.to_i - 1]
41
+ end
42
+
43
+ def book_name_no_spaces
44
+ row[:book_name].gsub(/\s/, '')
45
+ end
46
+
47
+ def anchor_tag_book_abbreviation
48
+ row[:ref_code]
49
+ end
50
+
51
+ def chapter_anchor_text
52
+ "-#{@chapter_number}" if @chapter_number.to_i > 0
53
+ end
54
+
55
+
56
+ # https://text.recoveryversion.bible/13_1Chronicles_1.htm#FCh1-19
57
+ # <prefix>/<bknum>_<bkname>_<chp>.htm#<bkrefcd><chp>-<verse>
58
+
59
+ # prefix: https://text.recoveryversion.bible/
60
+ # bknum: Bible book order number (i.e. 01 for Genesis, 40 for Matthew, and 66 for Revelation)
61
+ # bkname: Bible book name (i.e. Genesis, Exodus, Matthew, etc.)
62
+ # bkrefcd: 3 letter Bible Book reference code (i.e. Gen for Genesis, Fki for 1 Kings; See recver ref code list)
63
+ # chp: chapter number
64
+ # verse: verse number
65
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rcv_deeplink
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Philip Bradley
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-05-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Converts a reference to a deep link to LSM's bible text site
14
+ email: pdbradley@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/rcv_deeplink.rb
20
+ - lib/rcv_deeplink/reference.rb
21
+ homepage: https://rubygems.org/gems/rcv_deeplink
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.3.3
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: LSM reference helper tool
44
+ test_files: []