Sha256: 5ac83894938e7d5e630194ca719ff732ddc3da08207946beb1e0f2b2c6544475
Contents?: true
Size: 1.61 KB
Versions: 10
Compression:
Stored size: 1.61 KB
Contents
module Parliament module Decorators module ConstituencyGroup def name respond_to?(:constituencyGroupName) ? constituencyGroupName : '' end def start_date respond_to?(:constituencyGroupStartDate) ? DateTime.parse(constituencyGroupStartDate) : nil end def end_date respond_to?(:constituencyGroupEndDate) ? DateTime.parse(constituencyGroupEndDate) : nil end def seats respond_to?(:constituencyGroupHasHouseSeat) ? constituencyGroupHasHouseSeat : [] end def seat_incumbencies return @seat_incumbencies unless @seat_incumbencies.nil? seat_incumbencies = [] seats.each do |seat| seat_incumbencies << seat.seat_incumbencies end @seat_incumbencies = seat_incumbencies.flatten.uniq end def members return @members unless @members .nil? members = [] seat_incumbencies.each do |seat_incumbency| members << seat_incumbency.member end @members = members.flatten.uniq end def area respond_to?(:constituencyGroupHasConstituencyArea) ? constituencyGroupHasConstituencyArea.first : nil end def contact_points return @contact_points unless @contact_points.nil? contact_points = [] seat_incumbencies.each do |seat_incumbency| contact_points << seat_incumbency.contact_points end @contact_points = contact_points.flatten.uniq end def current? has_end_date = respond_to?(:constituencyGroupEndDate) !has_end_date end end end end
Version data entries
10 entries across 10 versions & 1 rubygems