Class: Marcxella::ControlField

Inherits:
Object
  • Object
show all
Defined in:
lib/marcxella/controlfield.rb

Overview

A control field (00X). Control fields have a value but no subfields

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ ControlField

Returns a new instance of ControlField.

Since:

  • 0.1.0



13
14
15
16
17
# File 'lib/marcxella/controlfield.rb', line 13

def initialize(node)
  @tag = node['tag']
  @value = node.text
  @subfields = []
end

Instance Attribute Details

#ForArray (readonly)

compatability. Always an empty array

Returns:

  • (Array)

    the current value of For



11
12
13
# File 'lib/marcxella/controlfield.rb', line 11

def For
  @For
end

#subfieldsObject (readonly)

Since:

  • 0.1.0



12
13
14
# File 'lib/marcxella/controlfield.rb', line 12

def subfields
  @subfields
end

#tagString (readonly)

the field tag

Returns:

  • (String)

    the current value of tag

Since:

  • 0.1.0



11
12
13
# File 'lib/marcxella/controlfield.rb', line 11

def tag
  @tag
end

#valueString (readonly)

the field value

Returns:

  • (String)

    the current value of value

Since:

  • 0.1.0



11
12
13
# File 'lib/marcxella/controlfield.rb', line 11

def value
  @value
end

Instance Method Details

#subfield(code) ⇒ Object

For compatability. Always returns an empty array because control fields don’t have subfields

Returns:

  • Array an empty array

Since:

  • 0.1.0



28
29
30
# File 'lib/marcxella/controlfield.rb', line 28

def subfield(code)
  @subfields
end

#to_sString

a string representation of the field.

Returns:

  • (String)

Since:

  • 0.1.0



21
22
23
# File 'lib/marcxella/controlfield.rb', line 21

def to_s
  "%s    %s" % [@tag, @value]
end