Class: AnyStyle::Normalizer::Punctuation

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

Instance Attribute Summary

Attributes inherited from AnyStyle::Normalizer

#keys, #skip

Instance Method Summary collapse

Methods inherited from AnyStyle::Normalizer

#append, #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



15
16
17
18
19
20
# File 'lib/anystyle/normalizer/punctuation.rb', line 15

def normalize(item, **opts)
  each_value(item) do |_, value|
    value.gsub!(/[\)\]\.,:;\p{Pd}\p{Z}\p{C}]+$/, '')
    value.gsub!(/^[\(\[]/, '')
  end
end