Sha256: 57de403e17b1ace48fed8364c2da13f909a1b33ace872f7b4f651d9042399c1e

Contents?: true

Size: 806 Bytes

Versions: 4

Compression:

Stored size: 806 Bytes

Contents

require 'berkeley_library/location/world_cat/symbols'

module BerkeleyLibrary
  module Location
    class LocationResult
      attr_reader :oclc_number, :wc_symbols, :ht_record_url, :wc_error, :ht_error

      def initialize(oclc_number, wc_symbols: [], wc_error: nil, ht_record_url: nil, ht_error: nil)
        @oclc_number = oclc_number
        @wc_symbols = wc_symbols
        @wc_error = wc_error
        @ht_record_url = ht_record_url
        @ht_error = ht_error
      end

      def nrlf?
        @has_nrlf ||= wc_symbols.intersection(WorldCat::Symbols::NRLF).any?
      end

      def srlf?
        @has_srlf ||= wc_symbols.intersection(WorldCat::Symbols::SRLF).any?
      end

      def uc_symbols
        @uc_symbols ||= wc_symbols.intersection(WorldCat::Symbols::UC)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
berkeley_library-location-4.1.0 lib/berkeley_library/location/location_result.rb
berkeley_library-location-4.0.0 lib/berkeley_library/location/location_result.rb
berkeley_library-location-3.0.0 lib/berkeley_library/location/location_result.rb
berkeley_library-location-2.0.0 lib/berkeley_library/location/location_result.rb