Class: Exlibris::Aleph::TabParser::SubLibrary
- Defined in:
- lib/exlibris/aleph/tabs_parser/sub_library.rb
Direct Known Subclasses
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
-
#initialize(args) ⇒ SubLibrary
constructor
A new instance of SubLibrary.
- #to_h ⇒ Object
Methods inherited from Base
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_h ⇒ Object
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 |