Petrovich allows you to decline Russian first names, last names, and patronymics (middlenames) into various grammatical cases. You provide the names in the nominative case, and the library returns the declined version.
Declining the full name
You can use specific case methods directly on the Petrovich object. To get the full string, call .to_s at the end.
Petrovich(
lastname: 'Салтыков-Щедрин',
firstname: 'Михаил',
middlename: 'Евграфович',
).dative.to_s # => "Салтыкову-Щедрину Михаилу Евграфовичу"
Declining specific parts of the name
You can use the .to(:case) method to decline a specific part and then call .middlename or .firstname to retrieve only that component.
Petrovich(
firstname: 'Иван',
middlename: 'Петрович',
).to(:instrumental).middlename # => "Петровича"
Supported Grammatical Cases
| Method | Case (Russian) | Question (Russian) |
|---|
genitive | родительный | Кого? |
dative | дательный | Кому? |
accusative | винительный | Кого? |
instrumental | творительный | Кем? |
prepositional | предложный | О ком? |