Sha256: 832c7931a26e3ab4af74524249b7daf8eb46553dad3cfef5ec2e55485beb7a9c

Contents?: true

Size: 641 Bytes

Versions: 3

Compression:

Stored size: 641 Bytes

Contents

module Exlibris
  module Aleph
    class Item
      class Queue
        attr_reader :value

        def initialize(value)
          @value = value
        end

        def to_s
          value
        end

        def number_of_requests
          @number_of_requests ||= begin
            if number_of_requests_matched_data.nil?
              0
            else
              number_of_requests_matched_data[1].to_i
            end
          end
        end

        private
        def number_of_requests_matched_data
          @number_of_requests_matched_data ||= /^(\d+) request\(s\)/.match(value)
        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/item/queue.rb
exlibris-aleph-2.0.3 lib/exlibris/aleph/item/queue.rb
exlibris-aleph-2.0.0 lib/exlibris/aleph/item/queue.rb