Class: Exlibris::Aleph::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/exlibris/aleph/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, display, sub_library) ⇒ Collection

Returns a new instance of Collection.



6
7
8
9
10
11
12
13
# File 'lib/exlibris/aleph/collection.rb', line 6

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

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/exlibris/aleph/collection.rb', line 4

def code
  @code
end

#displayObject (readonly)

Returns the value of attribute display.



4
5
6
# File 'lib/exlibris/aleph/collection.rb', line 4

def display
  @display
end

#sub_libraryObject (readonly)

Returns the value of attribute sub_library.



4
5
6
# File 'lib/exlibris/aleph/collection.rb', line 4

def sub_library
  @sub_library
end

Instance Method Details

#==(other_object) ⇒ Object Also known as: eql?



19
20
21
22
# File 'lib/exlibris/aleph/collection.rb', line 19

def ==(other_object)
  other_object.instance_of?(self.class) && code == other_object.code &&
    sub_library == other_object.sub_library
end

#to_sObject



15
16
17
# File 'lib/exlibris/aleph/collection.rb', line 15

def to_s
  display
end