edge 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +16 -0
- data/CHANGELOG.md +7 -1
- data/README.md +7 -0
- data/edge.gemspec +1 -1
- data/gemfiles/4.0.gemfile +5 -0
- data/gemfiles/4.1.gemfile +5 -0
- data/gemfiles/4.2.gemfile +5 -0
- data/lib/edge/forest.rb +1 -1
- data/lib/edge/version.rb +1 -1
- data/spec/database.yml.travis +5 -0
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aae17b676f3e8c7f0c5228f66a548816cd41bb17
|
4
|
+
data.tar.gz: a45d3fb5955a229e42e319fbfa99e2da9342e533
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51317099a665b022b83d0d5bda61d8483a636fb9fe0ff01cd5e5560e87999d283878a71cba51dc3f62cca1c19cf26570932bdf884c3617fa1877e96b0e9c2aa2
|
7
|
+
data.tar.gz: f526a15443b51f5cb52d7619f3cbdfd54cdf511cec4a33bf245b7e79c7a4a0bc0bfde6fbe5b00fae89f8d929e5a6ed4282db958b5f1d21291d29787b7872674c
|
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.2.0
|
4
|
+
- 2.1.5
|
5
|
+
- 2.0.0
|
6
|
+
gemfile:
|
7
|
+
- gemfiles/4.0.gemfile
|
8
|
+
- gemfiles/4.1.gemfile
|
9
|
+
- gemfiles/4.2.gemfile
|
10
|
+
|
11
|
+
addons:
|
12
|
+
postgresql: "9.2"
|
13
|
+
|
14
|
+
before_script:
|
15
|
+
- cp spec/database.yml.travis spec/database.yml
|
16
|
+
- bundle exec rake db:setup
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# 0.4.2 (May 21, 2015)
|
2
|
+
|
3
|
+
* Fixed premature SQL-ization that could result in PG protocol violation errors (Neil E. Pearson)
|
4
|
+
* Require Rails 4.0+
|
5
|
+
* Document ancestors method (science)
|
6
|
+
|
7
|
+
# 0.4.1 (January 15, 2015)
|
2
8
|
|
3
9
|
* Include rake as development dependency
|
4
10
|
* Fix for not passing string to belongs_to class_name (davekaro)
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Edge
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/jackc/edge.svg?branch=master)](https://travis-ci.org/jackc/edge)
|
4
|
+
|
3
5
|
Edge provides graph functionality to ActiveRecord using recursive common table
|
4
6
|
expressions. It has only been tested with PostgreSQL, but it uses Arel for
|
5
7
|
SQL generation so it should work with any database and adapter that support
|
@@ -50,6 +52,11 @@ must not be used after any other type of scope.
|
|
50
52
|
|
51
53
|
Location.where(name: "Illinois").with_descendants.all # [illinois, chicago]
|
52
54
|
|
55
|
+
Also supported is `ancestors` instance method which returns an array of all ancestors ordered by nearest ancestors first.
|
56
|
+
|
57
|
+
city = Location.where(name: 'Chicago')
|
58
|
+
ancestors = city.ancestors # [illinois, usa]
|
59
|
+
|
53
60
|
## Benchmarks
|
54
61
|
|
55
62
|
Edge includes a performance benchmarks. You can create test forests with a
|
data/edge.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Edge::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency 'activerecord', ">=
|
18
|
+
gem.add_dependency 'activerecord', ">= 4.0.0"
|
19
19
|
|
20
20
|
gem.add_development_dependency 'pg'
|
21
21
|
gem.add_development_dependency 'pry'
|
data/lib/edge/forest.rb
CHANGED
@@ -96,7 +96,7 @@ module Edge
|
|
96
96
|
# Only where scopes can precede this in a scope chain
|
97
97
|
def with_descendants
|
98
98
|
manager = recursive_manager.project(arel_table[:id])
|
99
|
-
scope = unscoped.where(
|
99
|
+
scope = unscoped.where(arel_table[:id].in manager)
|
100
100
|
scope.bind_values = current_scope.bind_values if current_scope
|
101
101
|
scope
|
102
102
|
end
|
data/lib/edge/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Christensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pg
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,6 +117,7 @@ extra_rdoc_files: []
|
|
117
117
|
files:
|
118
118
|
- ".gitignore"
|
119
119
|
- ".rspec"
|
120
|
+
- ".travis.yml"
|
120
121
|
- CHANGELOG.md
|
121
122
|
- Gemfile
|
122
123
|
- Guardfile
|
@@ -128,10 +129,14 @@ files:
|
|
128
129
|
- bench/database_structure.sql
|
129
130
|
- bench/forest_find.rb
|
130
131
|
- edge.gemspec
|
132
|
+
- gemfiles/4.0.gemfile
|
133
|
+
- gemfiles/4.1.gemfile
|
134
|
+
- gemfiles/4.2.gemfile
|
131
135
|
- lib/edge.rb
|
132
136
|
- lib/edge/forest.rb
|
133
137
|
- lib/edge/version.rb
|
134
138
|
- spec/database.yml
|
139
|
+
- spec/database.yml.travis
|
135
140
|
- spec/database_structure.sql
|
136
141
|
- spec/forest_spec.rb
|
137
142
|
- spec/spec_helper.rb
|