active_node 2.3.6 → 2.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/lib/active_node/core.rb +27 -0
- data/lib/active_node/version.rb +1 -1
- data/spec/functional/persistence_spec.rb +20 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77c70d1eb0d4e2b31cb814bbf2580cca4a5523f8
|
4
|
+
data.tar.gz: f93d7a8fe623813630ba63bf3e44b0e5580e0c54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a55ce03a65cb500ca528ffdec0bf4abc48dbce96fd66a6f44b93d23eba8a4c12d9b20c4aa2c1a62ba2e557a26b9772f9a2da89596d1dc6ffc3914ebbf95c033
|
7
|
+
data.tar.gz: 9ea612a3a3cebe13d862315c2383fc272b44c73b6c47b9beea0ac2abb6f8b88b39b7d4a44548b30c93ca8d2bb0a0c11f01b47b9f3a49ae634de1674cbe42a365
|
data/.travis.yml
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
script: "bundle exec rake neo4j:install['enterprise','2.3.2'] neo4j:unsecure neo4j:start spec --trace"
|
2
1
|
language: ruby
|
2
|
+
cache: bundler
|
3
3
|
rvm:
|
4
|
-
- 2.
|
4
|
+
- 2.2.2
|
5
|
+
script: "bundle exec rake neo4j:install['enterprise','2.3.2'] neo4j:unsecure neo4j:start spec --trace"
|
5
6
|
addons:
|
6
7
|
code_climate:
|
7
8
|
repo_token: 88fa9b8eb0bfc48e8c5077253d829e94af9f76aca60df9e75ae0e50a4c7cd9f0
|
data/lib/active_node/core.rb
CHANGED
@@ -6,5 +6,32 @@ module ActiveNode
|
|
6
6
|
@association_cache = {}
|
7
7
|
super attributes, split_by
|
8
8
|
end
|
9
|
+
|
10
|
+
# Returns true if +comparison_object+ is the same exact object, or +comparison_object+
|
11
|
+
# is of the same type and +self+ has an ID and it is equal to +comparison_object.id+.
|
12
|
+
#
|
13
|
+
# Note that new records are different from any other record by definition, unless the
|
14
|
+
# other record is the receiver itself. Besides, if you fetch existing records with
|
15
|
+
# +select+ and leave the ID out, you're on your own, this predicate will return false.
|
16
|
+
#
|
17
|
+
# Note also that destroying a record preserves its ID in the model instance, so deleted
|
18
|
+
# models are still comparable.
|
19
|
+
def ==(comparison_object)
|
20
|
+
super ||
|
21
|
+
comparison_object.instance_of?(self.class) &&
|
22
|
+
!id.nil? &&
|
23
|
+
comparison_object.id == id
|
24
|
+
end
|
25
|
+
alias :eql? :==
|
26
|
+
|
27
|
+
# Delegates to id in order to allow two records of the same type and id to work with something like:
|
28
|
+
# [ Person.find(1), Person.find(2), Person.find(3) ] & [ Person.find(1), Person.find(4) ] # => [ Person.find(1) ]
|
29
|
+
def hash
|
30
|
+
if id
|
31
|
+
id.hash
|
32
|
+
else
|
33
|
+
super
|
34
|
+
end
|
35
|
+
end
|
9
36
|
end
|
10
37
|
end
|
data/lib/active_node/version.rb
CHANGED
@@ -178,4 +178,24 @@ describe ActiveNode::Persistence do
|
|
178
178
|
expect(Address.create!.city).to eq "New York"
|
179
179
|
end
|
180
180
|
end
|
181
|
+
|
182
|
+
describe "eql?" do
|
183
|
+
before :each do
|
184
|
+
Client.create!(name: 'abc')
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should be equal" do
|
188
|
+
expect(Client.first).to eq Client.first
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe "hash" do
|
193
|
+
before :each do
|
194
|
+
Client.create!(name: 'abc')
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should be equal" do
|
198
|
+
expect(Client.first.hash).to eq Client.first.hash
|
199
|
+
end
|
200
|
+
end
|
181
201
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_node
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heinrich Klobuczek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_attr
|
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project: active_node
|
179
|
-
rubygems_version: 2.
|
179
|
+
rubygems_version: 2.5.1
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
182
|
summary: ActiveRecord style Object Graph Mapping for neo4j
|