Module: Parliament::Grom::Decorator::Party
- Defined in:
- lib/parliament/grom/decorator/party.rb
Overview
Decorator namespace for Grom::Node instances with type: id.parliament.uk/schema/Party
Instance Method Summary collapse
-
#commons_count ⇒ Integer?
Alias commonsCount with fallback.
-
#current? ⇒ Boolean
Checks if Grom::Node has any current members.
-
#lords_count ⇒ Integer?
Alias lordsCount with fallback.
-
#member_count ⇒ Integer?
Alias count with fallback.
-
#name ⇒ String
Alias partyName with fallback.
-
#party_memberships ⇒ Array
Alias partyHasPartyMembership with fallback.
Instance Method Details
#commons_count ⇒ Integer?
Alias commonsCount with fallback.
30 31 32 |
# File 'lib/parliament/grom/decorator/party.rb', line 30 def commons_count respond_to?(:commonsCount) ? commonsCount.to_i : nil end |
#current? ⇒ Boolean
Checks if Grom::Node has any current members.
44 45 46 47 48 |
# File 'lib/parliament/grom/decorator/party.rb', line 44 def current? no_current_total_members = member_count.nil? || member_count.zero? no_current_separate_members = (commons_count.nil? || commons_count.zero?) && (lords_count.nil? || lords_count.zero?) !no_current_total_members || !no_current_separate_members end |
#lords_count ⇒ Integer?
Alias lordsCount with fallback.
37 38 39 |
# File 'lib/parliament/grom/decorator/party.rb', line 37 def lords_count respond_to?(:lordsCount) ? lordsCount.to_i : nil end |
#member_count ⇒ Integer?
Alias count with fallback.
23 24 25 |
# File 'lib/parliament/grom/decorator/party.rb', line 23 def member_count respond_to?(:count) ? count.to_i : nil end |
#name ⇒ String
Alias partyName with fallback.
9 10 11 |
# File 'lib/parliament/grom/decorator/party.rb', line 9 def name respond_to?(:partyName) ? partyName : '' end |
#party_memberships ⇒ Array
Alias partyHasPartyMembership with fallback.
16 17 18 |
# File 'lib/parliament/grom/decorator/party.rb', line 16 def party_memberships respond_to?(:partyHasPartyMembership) ? partyHasPartyMembership : [] end |