Sha256: 9ce486ec54bcf4c4ea314909e3478f869e92dded88a40e9db5be588200fb9601
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
require 'berkeley_library/marc/field_info/var_fields/ind_val_def' require 'berkeley_library/marc/field_info/var_fields/obsolescible' module BerkeleyLibrary module Marc module FieldInfo module VarFields # An indicator definition. class IndDef # TODO: include Comparable include Obsolescible # Human-readable position names POS_NAMES = { 1 => 'First', 2 => 'Second' }.freeze attr_reader :pos attr_reader :desc attr_reader :val_defs def initialize(pos:, desc:, val_defs:) raise ArgumentError, "Not a valid indicator position: #{pos.inspect}" unless [1, 2].include?(pos) @pos = pos @desc = desc @val_defs = val_defs end # @see Obsolescible#reject_obsoletes def reject_obsoletes IndDef.new(pos: pos, desc: desc, val_defs: _reject_obsolete(val_defs)) end # see Object#to_s def to_s lines = ["#{POS_NAMES[pos]} - #{desc}"] val_defs.each { |v| lines << " #{v}" } lines.join("\n") end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
berkeley_library-marc-0.3.1 | lib/berkeley_library/marc/field_info/var_fields/ind_def.rb |
berkeley_library-marc-0.3.0 | lib/berkeley_library/marc/field_info/var_fields/ind_def.rb |