Sha256: edccdddf8009e083dfc50bd74773f3f6723693ed8bf211d9ff729720a0c3048d

Contents?: true

Size: 622 Bytes

Versions: 3

Compression:

Stored size: 622 Bytes

Contents

module Exlibris
  module Aleph
    class Item
      class CirculationStatus
        attr_reader :value

        def initialize(value)
          @value = value
        end

        def to_s
          value
        end

        def due_date
          @due_date ||= due_date_match[0] unless due_date_match.nil?
        end

        def ==(other_object)
          other_object.instance_of?(self.class) && value == other_object.value
        end
        alias_method :eql?, :==

        private
        def due_date_match
          @due_date_match ||= value.match(/\d{2}\/\d{2}\/\d{2}/)
        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/circulation_status.rb
exlibris-aleph-2.0.3 lib/exlibris/aleph/item/circulation_status.rb
exlibris-aleph-2.0.0 lib/exlibris/aleph/item/circulation_status.rb