Class: Traject::UMichFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/traject/umich_format.rb,
lib/traject/umich_format/version.rb

Overview

Encapsulates logic that uses University of Michigan University Library rules to determine both bib format (book, serial, visual material, etc.) and type, a more expansive list including both format (blu-ray, microform) and more semantic categories (bibliography, conference)

Defined Under Namespace

Modules: Macros Classes: BibFormat, BibTypes, XV6XX

Constant Summary

VERSION =
"0.4.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(marc_record) ⇒ UMichFormat

Construct a Formats object from the given record, calcuclating the bib_format and types

Parameters:

  • record (MARC::Record)


27
28
29
30
31
# File 'lib/traject/umich_format.rb', line 27

def initialize(marc_record)
  @record     = marc_record
  @bib_format = BibFormat.new(record).code
  @types      = BibTypes.new(@bib_format, record).codes
end

Instance Attribute Details

#bib_formatObject (readonly)

The bib format code as computed from the passed record



21
22
23
# File 'lib/traject/umich_format.rb', line 21

def bib_format
  @bib_format
end

#recordObject (readonly)

The record passed into the constructor



21
# File 'lib/traject/umich_format.rb', line 21

attr_reader :bib_format, :record, :types

#typesObject (readonly)

Returns the value of attribute types



21
# File 'lib/traject/umich_format.rb', line 21

attr_reader :bib_format, :record, :types

Instance Method Details

#format_and_typesObject



33
34
35
36
37
38
# File 'lib/traject/umich_format.rb', line 33

def format_and_types
  types = @types.dup
  types.unshift bib_format
  types.uniq!
  types
end