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: 4042561337573c6c6b793ba9610a2ab9c8c45b14
4
- data.tar.gz: 2d1d0478945bd0117de8d6aaf0d4f2e5d03bc6bc
3
+ metadata.gz: 15ec159c9aa83a40d4ade08ae439289456ae1901
4
+ data.tar.gz: 8f97c9f9475d02e59710c713d15db1acb504fc87
5
5
  SHA512:
6
- metadata.gz: bd591f0aff1b3b34504dce46a9ae10420eeec77f5e865d324abb9670003d8476126666da02034f41b4360e04d3f4137bc3c60b6980b3f1feafa6310310ebafda
7
- data.tar.gz: b06542fe08b2b2d1a4045d2c07be975aab60cd1e62ba66c35c3c38de25935e541c98b46dd193c9ad4f4f8e1b027f6e1a4f1d30387205fb7e2234119239f84d02
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 Subcollections related to the Grom::Node or an empty Array.
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
@@ -1,7 +1,7 @@
1
1
  module Parliament
2
2
  module Grom
3
3
  module Decorator
4
- VERSION = '0.22.2'.freeze
4
+ VERSION = '0.23.0'.freeze
5
5
  end
6
6
  end
7
7
  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.22.2
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-06 00:00:00.000000000 Z
11
+ date: 2018-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler