Sha256: 523aac3b1d33e29b6feb1345a62401fa93b4c65641dfa8c4a9cb5d3d7bcae70a

Contents?: true

Size: 829 Bytes

Versions: 5

Compression:

Stored size: 829 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

5 entries across 5 versions & 1 rubygems

Version Path
marc-0.0.2 lib/marc/control.rb
marc-0.0.3 lib/marc/control.rb
marc-0.0.4 lib/marc/control.rb
marc-0.0.5 lib/marc/control.rb
marc-0.0.6 lib/marc/control.rb