Class: Exlibris::Aleph::TabParser::SubLibrary

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

Instance Attribute Summary

Attributes inherited from Base

#config_array, #config_hash, #file_name, #hash_key, #library, #local_file, #local_path, #pattern, #pattern_key

Instance Method Summary collapse

Methods inherited from Base

#to_a

Constructor Details

#initialize(args) ⇒ SubLibrary

Returns a new instance of SubLibrary.



5
6
7
8
# File 'lib/exlibris/aleph/tabs_parser/sub_library.rb', line 5

def initialize(args)
  super(args)
  @aleph_sub_library_key = :sub_library
end

Instance Method Details

#to_hObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/exlibris/aleph/tabs_parser/sub_library.rb', line 10

def to_h
  a = self.to_a
  @config_hash = {}
  sl_a = a.collect do |i|
    i[@aleph_sub_library_key]
  end
  sl_a.uniq!
  sl_a.each do |sl|
    sl_hash = {}
    a.each do |i|
      isl = i[@aleph_sub_library_key]
      if isl.strip == sl.strip
        sl_hash[i[@hash_key]] = i
      end
    end
    @config_hash["#{sl}"] = sl_hash
  end
  return @config_hash
end