Class: Time

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

Instance Method Summary collapse

Instance Method Details

#show(format = nil) ⇒ Object



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

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



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

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