lib/nameable.rb in nameable-0.3.0 vs lib/nameable.rb in nameable-0.4.0
- old
+ new
@@ -76,10 +76,14 @@
Patterns::SUFFIX.each_pair do |pretty, regex|
suff = pretty if name[n] =~ regex
end
- if name[n] =~ Patterns::SUFFIX_ACADEMIC or name[n] =~ Patterns::SUFFIX_PROFESSIONAL or name[n] =~ Patterns::SUFFIX_GENERATIONAL_ROMAN or name[n] =~ Patterns::SUFFIX_ABBREVIATION
+ if name[n] =~ Patterns::SUFFIX_ACADEMIC or name[n] =~ Patterns::SUFFIX_PROFESSIONAL or name[n] =~ Patterns::SUFFIX_GENERATIONAL_ROMAN
+ suff = name[n].upcase.gsub(/\./,'')
+ end
+
+ if name.join != name.join.upcase and name[n].length > 1 and name[n] =~ Patterns::SUFFIX_ABBREVIATION
suff = name[n].upcase.gsub(/\./,'')
end
if suff
@suffix = @suffix ? "#{suff}, #{@suffix}" : suff