Class: ModsDisplay::NameFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/mods_display/name_formatter.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ NameFormatter

Returns a new instance of NameFormatter.



9
10
11
# File 'lib/mods_display/name_formatter.rb', line 9

def initialize(element)
  @element = element
end

Class Method Details

.format(element) ⇒ Object



5
6
7
# File 'lib/mods_display/name_formatter.rb', line 5

def self.format(element)
  new(element).format
end

Instance Method Details

#formatObject



13
14
15
16
17
18
# File 'lib/mods_display/name_formatter.rb', line 13

def format
  return element_text(display_form_nodeset) if display_form_nodeset.present?
  return name_parts if name_parts.present?

  nil
end