Class: AnyStyle::Normalizer::Publisher

Inherits:
AnyStyle::Normalizer show all
Defined in:
lib/anystyle/normalizer/publisher.rb

Instance Attribute Summary

Attributes inherited from AnyStyle::Normalizer

#keys, #skip

Instance Method Summary collapse

Methods inherited from AnyStyle::Normalizer

#append, #detect_language, #detect_scripts, #doi_extract, #each_value, #initialize, #keys_for, #map_values, #name, #skip?

Constructor Details

This class inherits a constructor from AnyStyle::Normalizer

Instance Method Details

#normalize(item, **opts) ⇒ Object


6
7
8
9
# File 'lib/anystyle/normalizer/publisher.rb', line 6

def normalize(item, **opts)
  replace_author(item) if item.key?(:author)
  item
end

#replace_author(item) ⇒ Object


11
12
13
14
15
# File 'lib/anystyle/normalizer/publisher.rb', line 11

def replace_author(item)
  each_value(item) do |_, value|
    value.gsub!(/^Author$/, item[:author][0])
  end
end