active_record_survey 0.1.26 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record_survey/node_map.rb +3 -3
- data/lib/active_record_survey/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2236594b733ee3733cb90bec502c89547d8ff779
|
4
|
+
data.tar.gz: 72f6a3a843a736f2a78fa6625932acedbf2d05f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77f3b496b4bfaaee2ffc278e1eac69290b7912c517a0eaa4dfd9acdadac162396e477fa7066db0b2ba43b2cd17a479bfa145cac38a1b18b0586a9c25e352ee51
|
7
|
+
data.tar.gz: dfc42d1aa7e04ab2fd8c714f7405ca1c5fddc0c7109d1bf7319518084ee47790111d5461521a10edb75c0d9b74bb07021af5721a193c4bda480eb21df6ad6ba8
|
@@ -10,7 +10,7 @@ module ActiveRecordSurvey
|
|
10
10
|
# Recursively creates a copy of this entire node_map
|
11
11
|
def recursive_clone
|
12
12
|
node_map = self.survey.node_maps.build(:survey => self.survey, :node => self.node)
|
13
|
-
self.
|
13
|
+
self.survey.node_maps.select { |i| i.parent == self && !i.marked_for_destruction? }.each { |child_node|
|
14
14
|
child_node.survey = self.survey # required due to voodoo - we want to use the same survey with the same object_id
|
15
15
|
node_map.children << child_node.recursive_clone
|
16
16
|
}
|
@@ -50,13 +50,13 @@ module ActiveRecordSurvey
|
|
50
50
|
|
51
51
|
# Check to see whether there is an infinite loop from this node_map
|
52
52
|
def has_infinite_loop?(path = [])
|
53
|
-
self.
|
53
|
+
self.survey.node_maps.select { |i| i.parent == self && !i.marked_for_destruction? }.each { |i|
|
54
54
|
# Detect infinite loop
|
55
55
|
if path.include?(self.node) || i.has_infinite_loop?(path.clone.push(self.node))
|
56
56
|
return true
|
57
57
|
end
|
58
58
|
}
|
59
|
-
|
59
|
+
path.include?(self.node)
|
60
60
|
end
|
61
61
|
|
62
62
|
def mark_self_and_children_for_destruction
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_survey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Butch Marshall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|