Class: Exlibris::Aleph::SubLibrary

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, display, admin_library) ⇒ SubLibrary

Returns a new instance of SubLibrary.



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

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

Instance Attribute Details

#admin_libraryObject (readonly)

Returns the value of attribute admin_library.



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

def admin_library
  @admin_library
end

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

#displayObject (readonly)

Returns the value of attribute display.



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

def display
  @display
end

Instance Method Details

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



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

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

#hashObject



25
26
27
# File 'lib/exlibris/aleph/sub_library.rb', line 25

def hash
  code.hash
end

#to_sObject



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

def to_s
  display
end