Class: Kreipinys

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

Constant Summary collapse

ENDINGS =
{
  'a'  => 'a',
  'A'  => 'A',
  'as' => 'ai',
  'AS' => 'AI',
  'ė'  => 'e',
  'Ė'  => 'E',
  'is' => 'i',
  'IS' => 'I',
  'us' => 'au',
  'US' => 'AU',
  'ys' => 'y',
  'YS' => 'Y',
}

Class Method Summary collapse

Class Method Details

.from(name) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/kreipinys.rb', line 21

def self.from(name)
  ENDINGS.each do |ending, substitution|
    if name.match(/#{ending}\z/)
      name = name.sub(/#{ending}\z/, substitution)
      break
    end
  end
  name
end