Sha256: 989399c1a6d8550849c913dcaef07f068ae959bd47c7f369db14383a15f5d78a

Contents?: true

Size: 1.69 KB

Versions: 3

Compression:

Stored size: 1.69 KB

Contents

module Exlibris
  module Aleph
    module Table
      module Reader
        class ItemCirculationPolicies < Base
          FILENAME = 'tab15.eng'

          def initialize(admin_library)
            super(admin_library, FILENAME)
          end

          def all
            rows.map do |row|
              sub_library = sub_libraries.find do |sub_library|
                sub_library.code == row.sub_library_code
              end
              unless sub_library.nil?
                status = Aleph::Item::Status.new(row.item_status_code)
                processing_status =
                  Aleph::Item::ProcessingStatus.new(row.item_processing_status_code)
                identifier = 
                  Aleph::Item::CirculationPolicy::Identifier.new(status, processing_status, sub_library)
                display_mask = item_display_masks[admin_library].find do |item_display_mask|
                  item_display_mask.value == row.display
                end
                mask = (display_mask.nil?) ? nil : display_mask.mask
                display = Aleph::Item::CirculationPolicy::Display.new(row.display, mask)
                privileges = Aleph::Item::CirculationPolicy::Privileges.new(row)
                Aleph::Item::CirculationPolicy.new(identifier, display, privileges)
              end
            end.compact
          end

          private
          def sub_libraries
            @sub_libraries ||= tables_manager.sub_libraries
          end

          def item_display_masks
            @item_display_masks ||= tables_manager.item_display_masks
          end

          def tables_manager
            @tables_manager ||= Aleph::TablesManager.instance
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
exlibris-aleph-2.0.4 lib/exlibris/aleph/table/reader/item_circulation_policies.rb
exlibris-aleph-2.0.3 lib/exlibris/aleph/table/reader/item_circulation_policies.rb
exlibris-aleph-2.0.0 lib/exlibris/aleph/table/reader/item_circulation_policies.rb