db_binary_search 1.0.0 → 1.1.1

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: 9b18dd20f169cd30905d627d4b12541f7337e318
4
- data.tar.gz: 054ddf798975a297cd62fe6c48d260bea69ca30a
3
+ metadata.gz: 7344d69362e835f84a56f046bdc3711c9fb578a6
4
+ data.tar.gz: 367024ece1a37954ffc6c51c09981fa55c0e37b2
5
5
  SHA512:
6
- metadata.gz: ee9e6b53bef4f1395f0e69be994d080317e80f1b55d2e0cd25c7f2a67960e6ccaca119865a83c4c6db416723ab77957a24aa97f5ab3a1531051490e1088ef322
7
- data.tar.gz: 09e6222d049611b7d9d0818ce80c9903efe574d34a571a8b03ce3b6d59fef7009f3d1de04095be191563d63b46837f253c47ec233041770557bfd198bd8b5c89
6
+ metadata.gz: 9c887e3c72bc884f7240e38e0ed21db59f8c41677d083d33bad081ee66e76fbc2810959684f806d3d53b2af4c5970279c7739397c08363336ecae63c048a28f7
7
+ data.tar.gz: 9c65aeff3195a6d30cf1d44d16e9a4e4519e2d38582be7d77ca1b1099b94f5a80e3841f3dfa057359b84abc014feb031909245dbde8a66a9a3010c83af67d87e
data/README.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  ![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)
4
4
  [![CI Status](http://img.shields.io/travis/acrookston/db_binary_search.svg?style=flat)](https://travis-ci.org/acrookston/db_binary_search)
5
- [![codebeat badge](https://codebeat.co/badges/24f76413-0c57-410c-9e90-45b5309e6442)](https://codebeat.co/projects/github-com-acrookston-db_binary_search)
5
+ [![Code Climate](https://codeclimate.com/github/acrookston/db_binary_search/badges/gpa.svg)](https://codeclimate.com/github/acrookston/db_binary_search)
6
6
  [![codecov](https://codecov.io/gh/acrookston/db_binary_search/branch/master/graph/badge.svg)](https://codecov.io/gh/acrookston/db_binary_search)
7
7
 
8
8
 
9
9
  An Active Support concern extending Active Record with the ability to binary
10
- search a table for use with non-indexed, chronologically sorted tables.
10
+ search a table for use with non-indexed, sorted tables.
11
11
 
12
12
  The gem allows you to avoid slow database scans if you have an
13
13
  auto-incrementing primary key running in parallel with a column which
@@ -59,8 +59,8 @@ binary_search(column, value, lower_id=nil, upper_id=nil)
59
59
 
60
60
  - `column` a symbol, is the table column to search for.
61
61
  - `value` a comparable value of same type as `column`, the value you are searching for.
62
- - `lower_id` optional primary key value to start searching lower bound at.
63
- - `upper_id` optional primary key value to start searching upper bound at.
62
+ - `lower_id` optional primary key value to start searching lower bound at. Defaults to `model.first.id`.
63
+ - `upper_id` optional primary key value to start searching upper bound at. Defaults to `model.last.id`.
64
64
 
65
65
  Full example:
66
66
 
@@ -81,7 +81,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
81
81
 
82
82
  ## Contributing
83
83
 
84
- Bug reports and pull requests are welcome on GitHub at https://github.com/arookston/db_binary_search.
84
+ Bug reports and pull requests are welcome on GitHub at https://github.com/acrookston/db_binary_search.
85
85
 
86
86
  If you're making a big change, please open an Issue first, so we can discuss. Otherwise:
87
87
 
@@ -9,8 +9,11 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Andrew Crookston"]
10
10
  spec.email = ["andrew@caoos.com"]
11
11
 
12
- spec.summary = %q{An Active Support concern extending Active Record with the ability to binary search a table for use with non-indexed, chronologically sorted tables.}
12
+ spec.summary = %q{An Active Support concern extending Active Record with the ability to binary search a table for use with non-indexed, sorted tables.}
13
13
  spec.description = %q{
14
+ An Active Support concern extending Active Record with the ability to binary
15
+ search a table for use with non-indexed, sorted tables.
16
+
14
17
  The gem allows you to avoid slow database scans if you have an
15
18
  auto-incrementing primary key running in parallel with a column which
16
19
  you want to search.
@@ -4,8 +4,8 @@ require 'active_record'
4
4
  module DBBinarySearch
5
5
  extend ActiveSupport::Concern
6
6
 
7
- class_methods do
8
- def binary_search(column, value, lower_id=nil, upper_id=nil)
7
+ included do
8
+ def self.binary_search(column, value, lower_id=nil, upper_id=nil)
9
9
  lower_id = self.first.id unless lower_id
10
10
  upper_id = self.last.id unless upper_id
11
11
 
@@ -1,3 +1,3 @@
1
1
  module DBBinarySearch
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_binary_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Crookston
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-29 00:00:00.000000000 Z
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -122,9 +122,10 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description: "\n The gem allows you to avoid slow database scans if you have an\n
126
- \ auto-incrementing primary key running in parallel with a column which\n you
127
- want to search.\n "
125
+ description: "\n An Active Support concern extending Active Record with the ability
126
+ to binary\n search a table for use with non-indexed, sorted tables.\n\n The
127
+ gem allows you to avoid slow database scans if you have an\n auto-incrementing
128
+ primary key running in parallel with a column which\n you want to search.\n "
128
129
  email:
129
130
  - andrew@caoos.com
130
131
  executables: []
@@ -168,5 +169,6 @@ rubygems_version: 2.4.3
168
169
  signing_key:
169
170
  specification_version: 4
170
171
  summary: An Active Support concern extending Active Record with the ability to binary
171
- search a table for use with non-indexed, chronologically sorted tables.
172
+ search a table for use with non-indexed, sorted tables.
172
173
  test_files: []
174
+ has_rdoc: