Class: Time

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

Instance Method Summary collapse

Instance Method Details

#show(format = nil) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/mordor.rb', line 73

def show(format = nil)
  return self.to_date.show(format) if [hour,min] == [0,0]
  case format
  when :human
    strftime("%d-%m-%Y %H:%m")
  when :full
    strftime("%d-%m-%Y %H:%M:%S")
  else
    to_s
  end
end

#to_dateObject



69
70
71
# File 'lib/mordor.rb', line 69

def to_date
  Date.civil(year, month, day)
end