Class: Time

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

Instance Method Summary collapse

Instance Method Details

#show(format = nil) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/auditing.rb', line 70

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



66
67
68
# File 'lib/auditing.rb', line 66

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