Sha256: a62776683c5928a031b9cf2c848c9d0ce403b941d7a7bc2aec8a1e0f549ef719

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

module Parliament
  module Grom
    module Decorator
      # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/GovRegisterGovernmentOrganisation.
      # rubocop:disable ModuleLength
      module GovRegisterGovernmentOrganisation
        include Helpers::DateHelper

        # Alias groupStartDate with fallback.
        #
        # @return [DateTime, nil] the start date of the Grom::Node or nil.
        def start_date
          @start_date ||= respond_to?(:groupStartDate) ? DateTime.parse(groupStartDate) : nil
        end

        # Alias groupEndDate with fallback.
        #
        # @return [DateTime, nil] the start date of the Grom::Node or nil.
        def end_date
          @end_date ||= respond_to?(:groupEndDate) ? DateTime.parse(groupEndDate) : nil
        end

        # Alias groupName with fallback.
        #
        # @return [String, String] the name of the Grom::Node or an empty string.
        def name
          respond_to?(:groupName) ? groupName : ''
        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/gov_register_government_organisation.rb
parliament-grom-decorators-0.19.0 lib/parliament/grom/decorator/gov_register_government_organisation.rb
parliament-grom-decorators-0.18.0 lib/parliament/grom/decorator/gov_register_government_organisation.rb
parliament-grom-decorators-0.17.0 lib/parliament/grom/decorator/gov_register_government_organisation.rb