Class: MARC::DataField
- Inherits:
-
Object
- Object
- MARC::DataField
- Defined in:
- lib/wcid/marc.rb
Instance Method Summary collapse
- #dates_from_datafield ⇒ Object
-
#name_from_datafield ⇒ Object
Should the following be private?.
-
#pnkey_from_marc ⇒ Object
accept a MARC datafield and create a pnkey for query really just a bunch of regexps to tur This should only really work for exact searches if the datafield passed to the method had proper authority work done on it.
- #qualifier_from_datafield ⇒ Object
Instance Method Details
#dates_from_datafield ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/wcid/marc.rb', line 33 def dates_from_datafield dates = self['d'] if self['d'] dates.gsub!('-', ' ') if dates dates.gsub!('.', '') if dates dates = "$" + dates if dates dates end |
#name_from_datafield ⇒ Object
Should the following be private?
25 26 27 28 29 30 31 32 |
# File 'lib/wcid/marc.rb', line 25 def name_from_datafield name = self['a'].downcase name.gsub!('.','') name.gsub!(/,$/,'') name.gsub!('-',' ') name.gsub!('\'','') name end |
#pnkey_from_marc ⇒ Object
accept a MARC datafield and create a pnkey for query really just a bunch of regexps to tur This should only really work for exact searches if the datafield passed to the method had proper authority work done on it.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/wcid/marc.rb', line 11 def pnkey_from_marc name = self.name_from_datafield dates = self.dates_from_datafield qualifier = self.qualifier_from_datafield query = "\"#{name}" query += "$" + qualifier if qualifier query += dates if dates query += "\"" #puts query query end |
#qualifier_from_datafield ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/wcid/marc.rb', line 40 def qualifier_from_datafield qualifier = self['q'] if self['q'] qualifier.gsub!('-', ' ') if qualifier qualifier.gsub!(',','') if qualifier qualifier.gsub!('(','') if qualifier qualifier.gsub!(')','') if qualifier qualifier.downcase! if qualifier end |