Module: Parliament::Grom::Decorator::Party

Defined in:
lib/parliament/grom/decorator/party.rb

Overview

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

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#member_countInteger?

Alias count with fallback.

Returns:

  • (Integer, nil)

    the count of members of the Grom::Node or nil.

Since:

  • 0.1.0



23
24
25
# File 'lib/parliament/grom/decorator/party.rb', line 23

def member_count
  respond_to?(:count) ? count.to_i : nil
end

#nameString

Alias partyName with fallback.

Returns:

  • (String, String)

    the party name of the Grom::Node or an empty string.

Since:

  • 0.1.0



9
10
11
# File 'lib/parliament/grom/decorator/party.rb', line 9

def name
  respond_to?(:partyName) ? partyName : ''
end

#party_membershipsArray

Alias partyHasPartyMembership with fallback.

Returns:

  • (Array, Array)

    the party memberships of the Grom::Node or an empty array.

Since:

  • 0.1.0



16
17
18
# File 'lib/parliament/grom/decorator/party.rb', line 16

def party_memberships
  respond_to?(:partyHasPartyMembership) ? partyHasPartyMembership : []
end