parliament-grom-decorators 0.12.0 → 0.12.1

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: d73636fa57db22ed08f0fae8f8a1f1e6a0e1cdcb
4
- data.tar.gz: 5bb160d1e8df59991fab0d00e645da9fc40f76e4
3
+ metadata.gz: 51e57a33a212ca35c68f2436d3178c0458315098
4
+ data.tar.gz: 8836f8d58905bb5c58acca433a8aa65e81593141
5
5
  SHA512:
6
- metadata.gz: 25ba62c53dadb7d21dab1507445f2f95c318d2ddb3b82faad91edc42c6e15a643a30bfdb4e91e951551cbaf28134cf8afcb0d3899211919bc8361ad429eacfc1
7
- data.tar.gz: 6dc3ca5525ae9d264e9a6563454763fd29a8e568ae369cb86bad02995369f1dea5b55057f6bb66ed69f58aa543f469dc39a8ced0c61e07cb43269246a09126b9
6
+ metadata.gz: 06adc2d5b62082e48690c06a7b0cfca2bd9181bd6b453125c21b894b9059c16425fd9cc706ebcae2e741412a61aaedc99eb484ccdaa300488d4ca145c77dbb41
7
+ data.tar.gz: 4157e584cf53dc513369d6d26ce24ce6bf1426b66180515052a4fa9c78b8a6b4635139d9cab99aec13f780c96e96dd89fe2ba666a8217645c2e42815a98c70ba
@@ -213,23 +213,23 @@ module Parliament
213
213
 
214
214
  # Alias personHasPersonalWebLink with fallback.
215
215
  #
216
- # @return [Array|String, nil] all the personal weblinks of the Grom::Node or an nil.
216
+ # @return [Array, Array] all the personal weblinks of the Grom::Node or an empty Array.
217
217
  def personal_weblinks
218
- respond_to?(:personHasPersonalWebLink) && (current_mp? || current_lord?) ? personHasPersonalWebLink : nil
218
+ [*get_weblinks_by_predicate(:personHasPersonalWebLink)]
219
219
  end
220
220
 
221
221
  # Alias personHasTwitterWebLink with fallback.
222
222
  #
223
- # @return [Array|String, nil] all the Twitter weblinks of the Grom::Node or an nil.
223
+ # @return [Array, Array] all the Twitter weblinks of the Grom::Node or an empty array.
224
224
  def twitter_weblinks
225
- respond_to?(:personHasTwitterWebLink) && (current_mp? || current_lord?) ? personHasTwitterWebLink : nil
225
+ [*get_weblinks_by_predicate(:personHasTwitterWebLink)]
226
226
  end
227
227
 
228
228
  # Alias personHasFacebookWebLink with fallback.
229
229
  #
230
- # @return [Array|String, nil] all the Facebook weblinks of the Grom::Node or an nil.
230
+ # @return [Array, Array] all the Facebook weblinks of the Grom::Node or an empty array.
231
231
  def facebook_weblinks
232
- respond_to?(:personHasFacebookWebLink) && (current_mp? || current_lord?) ? personHasFacebookWebLink : nil
232
+ [*get_weblinks_by_predicate(:personHasFacebookWebLink)]
233
233
  end
234
234
 
235
235
  private
@@ -265,6 +265,10 @@ module Parliament
265
265
  status[0] = status[0].downcase if index != 0
266
266
  end
267
267
  end
268
+
269
+ def get_weblinks_by_predicate(weblink_predicate)
270
+ (respond_to?(weblink_predicate) && (current_mp? || current_lord?) ? send(weblink_predicate) : nil)
271
+ end
268
272
  end
269
273
  end
270
274
  end
@@ -1,7 +1,7 @@
1
1
  module Parliament
2
2
  module Grom
3
3
  module Decorator
4
- VERSION = '0.12.0'.freeze
4
+ VERSION = '0.12.1'.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.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Appleyard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler