Class: Declinations
- Inherits:
-
Object
- Object
- Declinations
- Defined in:
- lib/kabal/languages/russian/declinations.rb
Class Method Summary collapse
- .end_with_two_or_three_of_four?(count) ⇒ Boolean
- .ends_with_one?(count) ⇒ Boolean
- .name_with_declination(ten_power_name, count) ⇒ Object
Class Method Details
.end_with_two_or_three_of_four?(count) ⇒ Boolean
19 20 21 |
# File 'lib/kabal/languages/russian/declinations.rb', line 19 def self.end_with_two_or_three_of_four?(count) count.to_s[-1] == "2" or count.to_s[-1] == "3" or count.to_s[-1] == "4" end |
.ends_with_one?(count) ⇒ Boolean
15 16 17 |
# File 'lib/kabal/languages/russian/declinations.rb', line 15 def self.ends_with_one?(count) count.to_s[-1] == "1" end |
.name_with_declination(ten_power_name, count) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/kabal/languages/russian/declinations.rb', line 2 def self.name_with_declination(ten_power_name, count) #FIXME add gem russian if ten_power_name[-1, 1] == "а" return ten_power_name if ends_with_one? count return ten_power_name[0..4] + "и" if end_with_two_or_three_of_four? count ten_power_name[0..4] else return ten_power_name if ends_with_one? count return ten_power_name + "а" if end_with_two_or_three_of_four? count ten_power_name + "ов" end end |