Module: MARCExtensions::DataFieldExtensions

Included in:
MARC::DataField
Defined in:
lib/marc_extensions/data_field.rb

Overview

Extensions for MARC::XMLReader.

Instance Method Summary collapse

Instance Method Details

#freezeMARC::DataField

Recursively freezes this datafield, along with its tag, indicators, and subfields.

Returns:



27
28
29
30
31
32
# File 'lib/marc_extensions/data_field.rb', line 27

def freeze
  [tag, indicator1, indicator2].each(&:freeze)
  subfields.each(&:freeze)
  subfields.freeze
  super
end

#frozen?Boolean

Whether this datafield and all its tag, indicators, and subfields are frozen.

Returns:

  • (Boolean)

    true if the field is frozen, false otherwise.



17
18
19
20
21
# File 'lib/marc_extensions/data_field.rb', line 17

def frozen?
  [tag, indicator1, indicator2, subfields].all?(&:frozen?) &&
    subfields.all?(&:frozen?) &&
    super
end

#subfield_codesArray

Returns a list of all the subfield codes in this data field.

Returns:

  • (Array)

    the subfield codes



9
10
11
# File 'lib/marc_extensions/data_field.rb', line 9

def subfield_codes
  subfields.map(&:code)
end