parliament-grom-decorators 0.22.2 → 0.23.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15ec159c9aa83a40d4ade08ae439289456ae1901
|
4
|
+
data.tar.gz: 8f97c9f9475d02e59710c713d15db1acb504fc87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b23a903ee24dddc8a0ee875a63986f33ee5ef743c2103af35b3336c8575037c0430b4a5bff38e01d186a90bf87c5534a64d9cac4985305fa49f744ca3bc00ef4
|
7
|
+
data.tar.gz: 4dc8a4bf09f0e9d0055094f54f7b17e1724df306a6df946cc1800546e8b1bc5f325270966c1b4d786ff1a0d784137b95eacc82ef24099cb7ecbdb94ba4df2c81
|
@@ -19,6 +19,13 @@ module Parliament
|
|
19
19
|
respond_to?(:collectionDescription) ? collectionDescription : ''
|
20
20
|
end
|
21
21
|
|
22
|
+
# Alias collectionExtendedDescription with fallback.
|
23
|
+
#
|
24
|
+
# @return [String, String] the extended description of the Grom::Node or an empty string.
|
25
|
+
def extended_description
|
26
|
+
respond_to?(:collectionExtendedDescription) ? collectionExtendedDescription : ''
|
27
|
+
end
|
28
|
+
|
22
29
|
# Alias collectionHasArticle with fallback.
|
23
30
|
#
|
24
31
|
# @return [Array, Array] an array of Articles related to the Grom::Node or an empty Array.
|
@@ -35,10 +42,20 @@ module Parliament
|
|
35
42
|
|
36
43
|
# Alias collectionHasParent with fallback.
|
37
44
|
#
|
38
|
-
# @return [Array, Array] an array of
|
45
|
+
# @return [Array, Array] an array of parent collections related to the Grom::Node or an empty Array.
|
39
46
|
def parents
|
40
47
|
respond_to?(:collectionHasParent) ? collectionHasParent : []
|
41
48
|
end
|
49
|
+
|
50
|
+
# Travel up the ancestry trees finding orphaned collections
|
51
|
+
#
|
52
|
+
# @return [Array, Array] an array of orphaned ancestral collections related to the Grom::Node or an empty Array.
|
53
|
+
def orphaned_ancestors(nodes = parents)
|
54
|
+
orphans = nodes.select { |node| node.parents.none? }
|
55
|
+
parent_nodes = (nodes - orphans).map(&:parents).flatten
|
56
|
+
orphans += orphaned_ancestors(parent_nodes) if parent_nodes.any?
|
57
|
+
orphans
|
58
|
+
end
|
42
59
|
end
|
43
60
|
end
|
44
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parliament-grom-decorators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rebecca Appleyard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|