lib/marc/datafield.rb in marc-0.1.4 vs lib/marc/datafield.rb in marc-0.1.5
- old
+ new
@@ -4,10 +4,20 @@
module MARC
# MARC records contain data fields, each of which has a tag,
# indicators and subfields. Tags for data fields must be in
# the range 010-999.
+ # Accessor attributes: tag ; indicator1 ; indicator2
+ #
+ # DataField includes enumerable for access to it's constituent
+ # Subfield objects. For instance, if you have a DataField representing
+ # a 856 tag, and want to find all 'z' subfields:
+ # urltag.find_all { |subfield| subfield.code == 'z' }
+ #
+ # Also, the accessor 'subfields' is an array of MARC::Subfield objects
+ # which can be accessed or modified by the client directly if
+ # neccesary.
class DataField
include Enumerable
# The tag for the field
@@ -83,10 +93,10 @@
return str
end
# Add a subfield (MARC::Subfield) to the field
- # field.append(MARC::Subfield('a','Dave Thomas'))
+ # field.append(MARC::Subfield.new('a','Dave Thomas'))
def append(subfield)
@subfields.push(subfield)
end