Sha256: 31d796e1599c6dc230224a839ff7d7d2e976b31748d9a3c0ca57338fe54aec3f

Contents?: true

Size: 909 Bytes

Versions: 5

Compression:

Stored size: 909 Bytes

Contents

module Parliament
  module Grom
    module Decorator
      # Decorator namespace for Grom::Node instances with type: http://id.ukpds.org/schema/Party
      module Party
        # Alias partyName with fallback.
        #
        # @return [String, String] the party name of the Grom::Node or an empty string.
        def name
          respond_to?(:partyName) ? partyName : ''
        end

        # Alias partyHasPartyMembership with fallback.
        #
        # @return [Array, Array] the party memberships of the Grom::Node or an empty array.
        def party_memberships
          respond_to?(:partyHasPartyMembership) ? partyHasPartyMembership : []
        end

        # Alias count with fallback.
        #
        # @return [Integer, nil] the count of members of the Grom::Node or nil.
        def member_count
          respond_to?(:count) ? count.to_i : nil
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
parliament-grom-decorators-0.1.3 lib/parliament/grom/decorator/party.rb
parliament-grom-decorators-0.1.2 lib/parliament/grom/decorator/party.rb
parliament-grom-decorators-0.1.1 lib/parliament/grom/decorator/party.rb
parliament-grom-decorators-0.1.0 lib/parliament/grom/decorator/party.rb
parliament-grom-decorators-0.0.1.pre lib/parliament/grom/decorator/party.rb