Sha256: 3a254370524a77070706aeeee74d7292c56968a533287008a16334ce7fba6e5f

Contents?: true

Size: 740 Bytes

Versions: 4

Compression:

Stored size: 740 Bytes

Contents

module Parliament
  module Grom
    module Decorator
      # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/Position.
      # rubocop:disable ModuleLength
      module Position
        # Alias positionName with fallback.
        #
        # @return [String, String] the name of the Grom::Node or an empty string.
        def name
          respond_to?(:positionName) ? positionName : 'Chair'
        end

        # Alias positionHasIncumbency with fallback.
        #
        # @return [Array, Array] all the incumbencies of the Grom::Node or an empty array.
        def incumbencies
          respond_to?(:positionHasIncumbency) ? positionHasIncumbency : []
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
parliament-grom-decorators-0.21.0 lib/parliament/grom/decorator/position.rb
parliament-grom-decorators-0.19.0 lib/parliament/grom/decorator/position.rb
parliament-grom-decorators-0.18.0 lib/parliament/grom/decorator/position.rb
parliament-grom-decorators-0.17.0 lib/parliament/grom/decorator/position.rb