Sha256: 387f72507540c44b2fb98e95397838f3559a9bc1da74a8320ee0b8f461320bfe

Contents?: true

Size: 724 Bytes

Versions: 3

Compression:

Stored size: 724 Bytes

Contents

module Exlibris
  module Aleph
    class SubLibrary
      attr_reader :code, :display, :admin_library

      def initialize(code, display, admin_library)
        unless admin_library.nil? || admin_library.is_a?(AdminLibrary)
          raise ArgumentError.new("Expecting #{admin_library} to be an AdminLibrary")
        end
        @code = code
        @display = display
        @admin_library = admin_library
      end

      def to_s
        display
      end

      def ==(other_object)
        other_object.instance_of?(self.class) && code == other_object.code &&
          admin_library == other_object.admin_library
      end
      alias_method :eql?, :==

      def hash
        code.hash
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
exlibris-aleph-2.0.4 lib/exlibris/aleph/sub_library.rb
exlibris-aleph-2.0.3 lib/exlibris/aleph/sub_library.rb
exlibris-aleph-2.0.0 lib/exlibris/aleph/sub_library.rb