parliament-grom-decorators 0.1.1 → 0.1.2

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: 204fa027f22472ede1d46a62bb7d38e000b44402
4
- data.tar.gz: 3950485ea1845b7863ab0c8efeb5117ef2086924
3
+ metadata.gz: 0e860f1e6fc16912229ea7d63e2d5ba81bfae8fc
4
+ data.tar.gz: ff70e5e6e30483aac559146677930509e61353d7
5
5
  SHA512:
6
- metadata.gz: 5f4113b2108599f25f3cd35e85760466ddd8a5e2dd0582da704fb9f54b2d6d53a8b115285365e989ecc30e6cac3f3007ff1b6fd5c33e8bed5c571437789e638e
7
- data.tar.gz: 9fb200cd7f4ec4664512c1e33a811ef1fc8256d7cb6f18f15f08b942fd11b3f07614f6e61cdc4601a5a6e64795f0f8d72d1226b6bc15f60746dcc6bbe470fb0c
6
+ metadata.gz: 2c7208e840ab9926e192bc34c75473d79f48389fb0dcaced447d4bda23b5d5d9e816583e9b767cd7ff349f4ef19865ffa3acd46d887790912d22c7242ab7e2ce
7
+ data.tar.gz: 4b2aed63bf20e08f1fd18941251b659a9c68d4efba10e44fd782f48103d69ba6bdf8f818ec62fec628af631d2b6f1852eb907e0ff6d666849ed66ef34117cebd
@@ -98,6 +98,34 @@ module Parliament
98
98
  def correct?
99
99
  @correct || false
100
100
  end
101
+
102
+ # Alias incumbencyHasMember with fallback.
103
+ #
104
+ # @return [Array, Array] the current member of the Grom::Node has a display name.
105
+
106
+ def current_member_display_name
107
+ return @current_member_display_name unless @current_member_display_name.nil?
108
+ current_incumbency = seat_incumbencies.select(&:current?).first
109
+ @current_member_display_name = current_incumbency.nil? ? nil : current_incumbency.member.display_name
110
+ end
111
+
112
+ # Alias party_name with fallback.
113
+ #
114
+ # @return [String, String] the name of the Grom::Node or an empty string.
115
+
116
+ def current_member_party_name
117
+ return @party_name unless @party_name.nil?
118
+ current_incumbency = seat_incumbencies.select(&:current?).first
119
+
120
+ if current_incumbency
121
+ current_membership = current_incumbency.member.party_memberships.select(&:current?).first
122
+ @party_name = current_membership.nil? ? nil : current_membership.party.name
123
+ else
124
+ @party_name = nil
125
+ end
126
+ @party_name
127
+ end
128
+
101
129
  end
102
130
  end
103
131
  end
@@ -1,7 +1,7 @@
1
1
  module Parliament
2
2
  module Grom
3
3
  module Decorator
4
- VERSION = '0.1.1'.freeze
4
+ VERSION = '0.1.2'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-grom-decorators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Appleyard
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  requirements: []
179
179
  rubyforge_project:
180
- rubygems_version: 2.6.8
180
+ rubygems_version: 2.6.11
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: Parliamentary Grom decorator