scriptura 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +73 -0
- data/lib/scriptura/data.rb +1576 -0
- data/lib/scriptura/scripture.rb +25 -0
- data/lib/scriptura/scripture_book.rb +67 -0
- data/lib/scriptura/scripture_chapter.rb +43 -0
- data/lib/scriptura/scripture_reference.rb +56 -0
- data/lib/scriptura/scripture_verse.rb +37 -0
- data/lib/scriptura.rb +7 -0
- metadata +69 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f281b8747bc911a6013b3b7abcec0b46c8a28ae6
|
4
|
+
data.tar.gz: 0d0ebdf115e31328e1f327e4af1e4e4078ea1931
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 622eef7218c890b1c8c362dd4a7ae6d64f0ae681e4f26ae32169923b44a525d20fd00bf467a33e25b27d4cb2daf59f07a8da222a08b566203796099de2789bf1
|
7
|
+
data.tar.gz: b1a43e4321ebeb165606c33c4ffc14486042a51b2964c66d79c22e453452e047c2729aa824e984d3432919b5960aab1224d416d3990b4af4310787b6c19a9916
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Gagan Awhad
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/gaganawhad/scriptura.png)](https://travis-ci.org/gaganawahd/scriptura)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/gaganawhad/scriptura.png)](https://codeclimate.com/github/gaganawhad/scriptura)
|
3
|
+
|
4
|
+
This is a ruby library that provides operations related with meta information about the Bible
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'scriptura'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install scriptura
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
There are four main classes in this library:
|
23
|
+
- ScriptureMeta
|
24
|
+
- ScriptureBook
|
25
|
+
- ScriptureChapter
|
26
|
+
- ScriptureVerse
|
27
|
+
- ScriptureReference
|
28
|
+
|
29
|
+
###ScriptureMeta
|
30
|
+
|
31
|
+
The way it is written, this is actually a module that encapsulates methods that scope the entire bible
|
32
|
+
```ruby
|
33
|
+
> ScriptureMeta.book_names
|
34
|
+
=> ["Genesis", "Exodus", "Leviticus", ... , "Revelation"]
|
35
|
+
|
36
|
+
```
|
37
|
+
###ScriptureBook
|
38
|
+
|
39
|
+
This is a ruby class that gets initialized by passing in the book number. You can also `find_by_name` the book or `find` it by its 'string_id'
|
40
|
+
|
41
|
+
Note: Books with no chapters are considered to be books with one chapter
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
> sb = ScriptureBook.new(1)
|
45
|
+
=> #<ScriptureBook:0x007fcb1b80f7f8 @number=1>
|
46
|
+
> sb.name
|
47
|
+
=> "Genesis"
|
48
|
+
> ScriptureBook.find_by_name("1 Corinthians")
|
49
|
+
=> #<ScriptureBook:0x007fa194831e80 @number=46>
|
50
|
+
> ScriptureBook.find_by_name("1 Corinthians").number
|
51
|
+
=> 46
|
52
|
+
> ScriptureBook.find("1-corinthians")
|
53
|
+
=> #<ScriptureBook:0x007fa195866378 @number=46>
|
54
|
+
> ScriptureBook.find("1-corinthians").number
|
55
|
+
=> 46
|
56
|
+
> ScriptureBook.find("1-corinthians").number_of_chapters
|
57
|
+
=> 16
|
58
|
+
```
|
59
|
+
|
60
|
+
It raises an error when trying to initalize a scripture book that doesn't exist
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
> ScriptureBook.new(67)
|
64
|
+
RuntimeError: book number should be within 1-66
|
65
|
+
.
|
66
|
+
.
|
67
|
+
|
68
|
+
```
|
69
|
+
|
70
|
+
Feel free to browse the code / test to get a sense of the API
|
71
|
+
|
72
|
+
|
73
|
+
|