Module: Traject::UMichFormat::Macros

Defined in:
lib/traject/umich_format/macros.rb

Instance Method Summary collapse

Instance Method Details

#umich_formatObject


12
13
14
15
16
17
18
# File 'lib/traject/umich_format/macros.rb', line 12

def umich_format
  tmap = Traject::TranslationMap.new('umich/format')
  ->(record, acc, context) do
    context.clipboard[:umich_format_obj] ||= Traject::UMichFormat.new(record)
    acc << tmap[context.clipboard[:umich_format_obj].bib_format]
  end
end

#umich_format_and_type_codesObject


36
37
38
39
40
41
# File 'lib/traject/umich_format/macros.rb', line 36

def umich_format_and_type_codes
  ->(record, acc, context) do
    context.clipboard[:umich_format_obj] ||= Traject::UMichFormat.new(record)
    acc.concat context.clipboard[:umich_format_obj].format_and_types
  end
end

#umich_format_and_typesObject


43
44
45
46
47
48
49
# File 'lib/traject/umich_format/macros.rb', line 43

def umich_format_and_types
  tmap = Traject::TranslationMap.new('umich/format')
  ->(record, acc, context) do
    context.clipboard[:umich_format_obj] ||= Traject::UMichFormat.new(record)
    acc.concat context.clipboard[:umich_format_obj].format_and_types.map{|x| tmap[x]}.uniq
  end
end

#umich_format_codeObject


5
6
7
8
9
10
# File 'lib/traject/umich_format/macros.rb', line 5

def umich_format_code
  ->(record, acc, context) do
    context.clipboard[:umich_format_obj] ||= Traject::UMichFormat.new(record)
    acc << context.clipboard[:umich_format_obj].bib_format
  end
end

#umich_type_codesObject


20
21
22
23
24
25
# File 'lib/traject/umich_format/macros.rb', line 20

def umich_type_codes
  ->(record, acc, context) do
    context.clipboard[:umich_format_obj] ||= Traject::UMichFormat.new(record)
    acc.concat context.clipboard[:umich_format_obj].types
  end
end

#umich_typesObject


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

def umich_types
  tmap = Traject::TranslationMap.new('umich/format')
  ->(record, acc, context) do
    context.clipboard[:umich_format_obj] ||= Traject::UMichFormat.new(record)
    acc.concat context.clipboard[:umich_format_obj].types.map{|x| tmap[x]}
  end

end