Module: Parliament::Decorators::PartyMembership

Defined in:
lib/parliament/decorators/party_membership.rb

Overview

Decorator namespace for Grom::Node instances with type: id.ukpds.org/schema/PartyMembership

Instance Method Summary collapse

Instance Method Details

#current?Boolean

Checks if Grom::Node has an end date.


29
30
31
32
33
# File 'lib/parliament/decorators/party_membership.rb', line 29

def current?
  has_end_date = respond_to?(:partyMembershipEndDate)

  !has_end_date
end

#end_dateDateTime?

Alias partyMembershipEndDate with fallback.


22
23
24
# File 'lib/parliament/decorators/party_membership.rb', line 22

def end_date
  respond_to?(:partyMembershipEndDate) ? DateTime.parse(partyMembershipEndDate) : nil
end

#partyGrom::Node?

Alias partyMembershipHasParty with fallback.


8
9
10
# File 'lib/parliament/decorators/party_membership.rb', line 8

def party
  respond_to?(:partyMembershipHasParty) ? partyMembershipHasParty.first : nil
end

#start_dateDateTime?

Alias partyMembershipStartDate with fallback.


15
16
17
# File 'lib/parliament/decorators/party_membership.rb', line 15

def start_date
  respond_to?(:partyMembershipStartDate) ? DateTime.parse(partyMembershipStartDate) : nil
end