Sha256: 49cc340253386a1f7e447fc4dff18bc3a648374f35ed99f7d6b14df040e78aa0

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

module MARC

  # A class for representing fields with a tag less than 010.
  # Ordinary MARC::Field objects are for fields with tags >= 010
  # which have indicators and subfields.

  class Control

    # the tag value (007, 008, etc)
    attr_accessor :tag

    # the value of the control field
    attr_accessor :value

    # The constructor which must be passed a tag value and 
    # an optional value for the field.

    def initialize(tag,value='')
      @tag = tag
      @value = value
      if tag.to_i > 9 
        raise MARC::Exception.new(), "tag must be greater than 009"
      end
    end

    def to_s
      return "#{tag} #{value}" 
    end

    def =~(regex)
      return self.to_s =~ regex
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marc-0.0.7 lib/marc/control.rb