Sha256: 4478dabc7425be5d48610e8139050da6c6eb2b53b7583762b1b0247c6a34262b
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
require 'marcspec/controlfieldspec' module MARCSpec # A LeaderSpec deals only with the leader. It's basically the same as a controlfield spec, but # using the string 'LDR' to identify itself class LeaderSpec < ControlFieldSpec # Built to be syntax-compatible with ControlFieldSpec, the tag must always # be 'LDR' (case matters) # # @param ['LDR'] tag The 'tag'; in this case, always 'LDR' # @param [Fixnum, Range<Fixnum>] range substring specification (either one character or a range) to return # instead of the whole leader. def initialize (tag, range=nil) unless tag == 'LDR' raise ArgumentError "Tag must be 'LDR' for a LeaderSpec" end @tag = 'LDR' self.range = range end # Return the appropriate value (either the leader or a subset of it) from the # given record # # @param [MARC4J4R::Record] r A MARC4J4R Record # @return [String] the leader or substring of the leader def marc_values r if @range return r.leader[@range] else return r.leader end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
marcspec-0.7.3 | lib/marcspec/leaderspec.rb |
marcspec-0.7.2 | lib/marcspec/leaderspec.rb |
marcspec-0.7.1 | lib/marcspec/leaderspec.rb |
marcspec-0.7.0 | lib/marcspec/leaderspec.rb |