active_record_survey 0.1.38 → 0.1.39
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 +15 -0
- 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: 60c9449620b59d5e5fead5ab4a0d168a20f09695
|
4
|
+
data.tar.gz: 477a7031adf2e0efe973606157f39bcec522b2bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36524e334c8ea4e54c402d2f1c2210a558b36dd6fbaf800ba509f9b7040ee3bf2a14620e20a7206c5fec546aa34c166de5b8e248fe971660c4900132acfda450
|
7
|
+
data.tar.gz: 625e0143247e13506f40b40f096ea0f5627f41671ad84793c736ed49bba4854c31b4d3fb5cba1ab13770a9dc26f5d0fe1baf39f7e0aa78a17535346acaf28137
|
@@ -37,6 +37,21 @@ module ActiveRecordSurvey
|
|
37
37
|
result
|
38
38
|
end
|
39
39
|
|
40
|
+
# Whether decendant of a particular node_map
|
41
|
+
def is_decendant_of?(node_map)
|
42
|
+
# Hit ourselves
|
43
|
+
if node_map == self
|
44
|
+
return true
|
45
|
+
end
|
46
|
+
|
47
|
+
# Recurse
|
48
|
+
if self.parent
|
49
|
+
return self.parent.is_decendant_of?(node_map)
|
50
|
+
end
|
51
|
+
|
52
|
+
false
|
53
|
+
end
|
54
|
+
|
40
55
|
# Gets all the ancestor nodes until one is not an ancestor of klass
|
41
56
|
def ancestors_until_node_not_ancestor_of(klass)
|
42
57
|
if !self.parent || !self.node.class.ancestors.include?(klass)
|
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.39
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Butch Marshall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|