Class: Relaton::Render::Ietf::Fields

Inherits:
Fields
  • Object
show all
Defined in:
lib/relaton/render/fields.rb

Instance Method Summary collapse

Instance Method Details

#compound_fields_format(hash) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/relaton/render/fields.rb', line 24

def compound_fields_format(hash)
  ret = super
  ret[:included]&.each do |h|
    compound_fields_format(h)
  end
  ret
end

#dateformat(date, _hash, _type) ⇒ Object

do not format months



19
20
21
22
# File 'lib/relaton/render/fields.rb', line 19

def dateformat(date, _hash, _type)
  date.nil? and return nil
  date_range(date)
end

#nameformat(names) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/relaton/render/fields.rb', line 5

def nameformat(names)
  names.nil? and return names
  parts = %i(surname initials given middle nonpersonal
             nonpersonalabbrev completename)
  names_out = names.each_with_object({}) do |n, m|
    parts.each do |i|
      m[i] ||= []
      m[i] << n[i]
    end
  end
  @r.nametemplate.render(names_out)
end