Sha256: 4f6863b8bec02ecf6108128ebd631930af2dbde6f09caa0eb31ba837c67528e5
Contents?: true
Size: 939 Bytes
Versions: 3
Compression:
Stored size: 939 Bytes
Contents
module Exlibris module Aleph class Items extend Forwardable def_delegators :to_a, :each, :size include Enumerable attr_reader :record_id def initialize(record_id) @record_id = record_id end def to_a @array ||= ids.map { |id| Item.new(record_id, id) } end private def client @client ||= API::Client::Record::Items.new(record_id) end def root @root ||= client.root end def items_root @items_root ||= root['items'] end def items @items ||= items_root['item'] unless items_root.nil? end def ids @ids ||= begin if items.nil? [] else items.map do |item| href = (items.size > 1) ? item['href'] : item[1] href.split('/').pop end 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/items.rb |
exlibris-aleph-2.0.3 | lib/exlibris/aleph/items.rb |
exlibris-aleph-2.0.0 | lib/exlibris/aleph/items.rb |