Class: MARC::Record
- Inherits:
-
Object
show all
- Defined in:
- lib/enhanced_marc/record.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Record
Creates a new MARC::Record using MARC::Leader to work with the leader, rather than a string
8
9
10
11
|
# File 'lib/enhanced_marc/record.rb', line 8
def initialize
@fields = []
@leader = Leader.new(' ' * 24)
end
|
Instance Attribute Details
#bibliographic_level ⇒ Object
Returns the value of attribute bibliographic_level.
4
5
6
|
# File 'lib/enhanced_marc/record.rb', line 4
def bibliographic_level
@bibliographic_level
end
|
#record_type ⇒ Object
Returns the value of attribute record_type.
4
5
6
|
# File 'lib/enhanced_marc/record.rb', line 4
def record_type
@record_type
end
|
Class Method Details
.new_from_record(record) ⇒ Object
Instance Method Details
47
48
|
# File 'lib/enhanced_marc/record.rb', line 47
def composition_form(human_readable=false)
end
|
#contains_type?(record_type) ⇒ Boolean
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/enhanced_marc/record.rb', line 13
def contains_type?(record_type)
type_map = {"BKS"=>/[at]{1}/, "COM"=>"m", "MAP"=>/[ef]{1}/,"MIX"=>"p", "SCO"=>/[cd]{1}/, "REC"=>/[ij]{1}/, "SER"=>"s", "VIS"=>/[gkor]{1}/}
matching_fields = []
@fields.find_all {|f| ('006') === f.tag}.each { | fxd_fld |
matching_fields << fxd_fld if fxd_fld.value[0,1].match(type_map[record_type])
}
return nil if matching_fields.empty?
return matching_fields
end
|
#created_on ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/enhanced_marc/record.rb', line 60
def created_on
unless self['008'].value[0,6] == (' '*6)
return Date.parse(self['008'].value[0,2]+'-'+self['008'].value[2,2]+'-'+self['008'].value[4,2], false)
else
return Date.today
end
end
|
#get_dates ⇒ Object
56
57
58
|
# File 'lib/enhanced_marc/record.rb', line 56
def get_dates
end
|
#inspect_fixed_fields ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/enhanced_marc/record.rb', line 68
def inspect_fixed_fields
type_map = {/[at]{1}/=>BookType,'m'=>ComputerType,/[ef]{1}/=>MapType,
'p'=>MixedType,/[cd]{1}/=>ScoreType,/[ij]{1}/=>SoundType,'s'=>SerialType,
/[gkor]{1}/=>VisualType}
@fields.find_all {|f| ('006') === f.tag}.each { | fxd_fld |
type_map.each_key { | key |
if fxd_fld.value[0,1].match(key)
self.extend type_map[key]
end
}
}
end
|
#is_archival? ⇒ Boolean
42
43
44
|
# File 'lib/enhanced_marc/record.rb', line 42
def is_archival?
return @leader.is_archival?
end
|
#publication_country ⇒ Object
51
52
53
54
|
# File 'lib/enhanced_marc/record.rb', line 51
def publication_country
return self['008'].value[15,2] unless self['008'].value[15,2] == ' '
return false
end
|
#to_typed_record ⇒ Object
38
39
40
|
# File 'lib/enhanced_marc/record.rb', line 38
def to_typed_record
return self.new_from_record(self)
end
|