Sha256: 920f93ea2d7886a63d0f51c8750e54e0257b14cd4afe57b1b3c9d964b976f8a6

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

module Qa::Authorities
  ##
  # @abstract The base class for all authorites. Implementing subclasses must
  #   provide {#all} and #{find} methods.
  # @todo What about {#search}?
  class Base
    ##
    # @abstract By default, #all is not implemented. A subclass authority must
    #   implement this method to conform to the generic interface.
    #
    # @return [Enumerable]
    # @raise [NotImplementedError] when this method is abstract.
    #
    # @todo better specify return type
    def all
      raise NotImplementedError, "#{self.class}#all is unimplemented."
    end

    ##
    # @abstract By default, #find is not implemented. A subclass authority must
    #   implement this method to conform to the generic interface.
    #
    # @param id [String] the id string for the authority to lookup
    #
    # @return [Hash]
    # @raise [NotImplementedError] when this method is abstract.
    #
    # @todo better specify return type
    def find(_id)
      raise NotImplementedError, "#{self.class}#find is unimplemented."
    end

    class_attribute :linked_data, instance_writer: false
    self.linked_data = false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qa-5.14.0 lib/qa/authorities/base.rb