kj 0.0.15 → 0.0.16

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: 8a9f1ae7069ea9589316a04b3fdab9c7ebc66330
4
- data.tar.gz: 9409e75e89768a71a76229b561737ab40f3ab44b
3
+ metadata.gz: b3c0f88d0a65cd67a819c6ede12a1295bfb061cf
4
+ data.tar.gz: 599c01ca8ad113d4662d1e3b4ab586f300dfe052
5
5
  SHA512:
6
- metadata.gz: 2be24a33435f0329e246eee2d01334e8e2ecdb0934e6fedade4fb7704f1e1f21d4502043e559abe9d12468e478be90976ea5a301365d0e9ee1eda16eb98f4a5a
7
- data.tar.gz: ad8b9ae4438462a8da3133d74fe3cb6f7ccc391ec221b131e47d9b610bd8815e9d63d1ee84f95d6f3267ef5c75b0023947f5fbbc9b165c1e6ffd6d2b05f717fe
6
+ metadata.gz: 717f461db4ca1b6c2ba3669f6582a93ed0cebad2bd4e21eaddbffe75a516e16760407123268576d2df5e38ecb2ff5a08e7d4e2baa4a624217a5c429d7d75e5b4
7
+ data.tar.gz: 35c4d11ad62a43379cde54204acbd8ab7a2b17fabb9a45638f0d39e885c8f0befd34c4968ecd262815f3ded82a77d12af52c1c06bac212a8cb88390e0b46ce09
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.15
1
+ 0.0.16
data/kj.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: kj 0.0.15 ruby lib
5
+ # stub: kj 0.0.16 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "kj"
9
- s.version = "0.0.15"
9
+ s.version = "0.0.16"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["David John"]
14
- s.date = "2015-08-11"
14
+ s.date = "2015-08-23"
15
15
  s.description = "kj is a simple rubygem for accessing the King James Bible. It uses an embedded sqlite data store."
16
16
  s.email = "djohn@arch-no.org"
17
17
  s.extra_rdoc_files = [
@@ -4,7 +4,7 @@ module Kj
4
4
 
5
5
  class Book < Base
6
6
 
7
- attr_accessor :id, :name, :permalink
7
+ attr_accessor :id, :name, :permalink, :abbreviations
8
8
 
9
9
  def initialize(args)
10
10
  args.each do |k,v|
@@ -34,15 +34,15 @@ module Kj
34
34
  numbers = names_or_numbers.uniq.select{|n| n.is_a?(Integer)}
35
35
  names = (names_or_numbers - numbers).uniq.map{|name| name.to_s.downcase}
36
36
  results = []
37
- results << Db.query("SELECT id, name, permalink FROM books WHERE id IN (#{numbers.join(',')})") if numbers.any?
38
- names.each{ |name| results << Db.query("SELECT id, name FROM books WHERE abbreviations LIKE ? OR permalink = ?", ["%#{name.to_s}%", name.to_s]) }
39
- results.flatten.map!{|book| new(id: book['id'], name: book['name'], permalink: book['permalink'])}.uniq.sort!{ |a,b| a.id <=> b.id }
37
+ results << Db.query("SELECT id, name, permalink, abbreviations FROM books WHERE id IN (#{numbers.join(',')})") if numbers.any?
38
+ names.each{ |name| results << Db.query("SELECT id, name, permalink, abbreviations FROM books WHERE abbreviations LIKE ? OR permalink = ?", ["%#{name.to_s}%", name.to_s]) }
39
+ results.flatten.map!{|book| new(id: book['id'], name: book['name'], permalink: book['permalink'], abbreviations: book['abbreviations'])}.uniq.sort!{ |a,b| a.id <=> b.id }
40
40
  end
41
41
 
42
42
  def self.all
43
43
  @all ||= begin
44
- books = Db.query("SELECT id, name, permalink FROM books")
45
- books.map{ |book| new(id: book['id'], name: book['name'], permalink: book['permalink']) }
44
+ books = Db.query("SELECT id, name, permalink, abbreviations FROM books")
45
+ books.map{ |book| new(id: book['id'], name: book['name'], permalink: book['permalink'], abbreviations: book['abbreviations']) }
46
46
  end
47
47
  end
48
48
 
@@ -73,12 +73,12 @@ module Kj
73
73
  def verses(*numbers)
74
74
  if numbers.empty?
75
75
  @verses ||= begin
76
- results = Db.query("SELECT id, number FROM verses WHERE chapter_id = ?", [id])
77
- results.map{|verse| Verse.new(id: verse['id'], book_name: book_name, chapter_id: id, number: verse['number'])}
76
+ results = Db.query("SELECT id, number, page FROM verses WHERE chapter_id = ?", [id])
77
+ results.map{|verse| Verse.new(id: verse['id'], book_name: book_name, chapter_id: id, number: verse['number'], page: verse['page'])}
78
78
  end
79
79
  else
80
- results = Db.query("SELECT id, number FROM verses WHERE chapter_id = #{id} AND number IN (#{numbers.flatten.join(',')})")
81
- results.map!{|verse| Verse.new(id: verse['id'], book_name: book_name, chapter_id: id, number: verse['number'])}.sort!{ |a,b| a.id <=> b.id }
80
+ results = Db.query("SELECT id, number, page FROM verses WHERE chapter_id = #{id} AND number IN (#{numbers.flatten.join(',')})")
81
+ results.map!{|verse| Verse.new(id: verse['id'], book_name: book_name, chapter_id: id, number: verse['number'], page: verse['page'])}.sort!{ |a,b| a.id <=> b.id }
82
82
  end
83
83
  end
84
84
 
@@ -4,7 +4,7 @@ module Kj
4
4
 
5
5
  class Verse < Base
6
6
 
7
- attr_accessor :id, :chapter_id, :number
7
+ attr_accessor :id, :chapter_id, :number, :page
8
8
  attr_writer :chapter
9
9
 
10
10
  def initialize(args)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - David John
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-11 00:00:00.000000000 Z
11
+ date: 2015-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3