Module: Rudate

Defined in:
lib/rudate.rb,
lib/rudate/version.rb

Constant Summary collapse

VERSION =
"0.0.6"

Class Method Summary collapse

Class Method Details

.time(tm) ⇒ Object



10
11
12
13
14
15
# File 'lib/rudate.rb', line 10

def self.time(tm)
  day = tm.strftime("%d").to_i
  month = tm.strftime("%m").to_i
  year = tm.strftime("%Y").to_i
  self.to_s(year,month,day)
end

.to_s(year, month, day) ⇒ Object



5
6
7
8
# File 'lib/rudate.rb', line 5

def self.to_s(year, month, day)
  month_names = %w{nil Января Февраля Марта Апреля Мая Июня Июля Августа Сентября Октября Ноября Декабря}
  day.to_s + " " + month_names[month].to_s + " " + year.to_s + "г"
end