Sha256: 8f2e5bcf51bd3f362927e38be524cc332713ea0d8f99b72ed8088f8d3221f229
Contents?: true
Size: 1.8 KB
Versions: 13
Compression:
Stored size: 1.8 KB
Contents
module Parliament module Grom module Decorator # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/ContactPoint module ContactPoint # Alias contactPointHasPostalAddress with fallback. # # @return [Array, Array] an array of the postal addresses for the Grom::Node or an empty array. def postal_addresses respond_to?(:contactPointHasPostalAddress) ? contactPointHasPostalAddress : [] end # Alias email with fallback. # # @return [String, String] the email of the Grom::Node or an empty string. def email instance_variable_get('@email'.to_sym).nil? ? '' : instance_variable_get('@email'.to_sym) end # Alias phoneNumber with fallback. # # @return [String, String] the phone number of the Grom::Node or an empty string. def phone_number respond_to?(:phoneNumber) ? phoneNumber : '' end # Alias faxNumber with fallback. # # @return [String, String] the fax number of the Grom::Node or an empty string. def fax_number respond_to?(:faxNumber) ? faxNumber : '' end # Alias contactPointHasPerson with fallback. # # @return [Array, Array] the person connected to the Grom::Node or an empty array. def person respond_to?(:contactPointHasPerson) ? contactPointHasPerson : [] end # Alias contactPointHasParliamentaryIncumbency with fallback. # # @return [Grom::Node, nil] the parliamentary incumbency of the Grom::Node or nil. def parliamentary_incumbency respond_to?(:contactPointHasParliamentaryIncumbency) ? contactPointHasParliamentaryIncumbency.first : nil end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems