Sha256: 05829452e957338ceb5373d9c0e2829a57c2104f04cabb7ea285500c7d0e1fd8
Contents?: true
Size: 964 Bytes
Versions: 2
Compression:
Stored size: 964 Bytes
Contents
require 'berkeley_library/marc/field_info/var_fields/section' require 'berkeley_library/marc/field_info/var_fields/obsolescible' module BerkeleyLibrary module Marc module FieldInfo module VarFields class VarFieldList include Enumerable include Obsolescible attr_reader :desc, :sections def initialize(desc:, sections:) @desc = desc @sections = sections end def each(&block) return to_enum(:each) unless block_given? sections.each { |section| section.each(&block) } end def size sections.sum(&:size) end def reject_obsoletes VarFieldList.new( desc: desc, sections: _reject_obsolete(sections) ) end def to_s sections.map(&:to_s).join("\n") end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems