lib/greek_names.rb in greek_names-0.0.1 vs lib/greek_names.rb in greek_names-0.0.2
- old
+ new
@@ -12,11 +12,11 @@
# 2.1.3 :001 > GreekNames.vocative("Αντώνης")
# => "Αντώνη"
# 2.1.3 :002 > GreekNames.vocative("Μαρία")
# => "Μαρία"
def vocative(string)
- if string[-2..-1].match(/(ας)|(ης)|(ΑΣ)|(ΗΣ)/)
+ if string[-2..-1].match(/(ας|άς)|(ης|ής)|(ΑΣ)|(ΗΣ)/)
string.chop
elsif string[-2..-1].match(/(ος|ός)|(ΟΣ)/)
maleInOS(string)
else
string
@@ -24,10 +24,10 @@
end
def maleInOS(string)
case string.to_s[-4..-1]
- when /(γος)|(άνος|ανος)|(τος)|(ΓΟΣ)|(ΑΝΟΣ)|(ΓΟΣ)/ then string.chop
+ when /(γος|γός)|(άνος|ανος|ανός)|(τος|τός)|(ΓΟΣ)|(ΑΝΟΣ)|(ΤΟΣ)/ then string.chop
else string[-2..-1].match(/(ΟΣ)/) ? string.gsub('ΟΣ','Ε') : string.gsub(/(ός|ος)/,'ε')
end
end
end