Class: Date

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

Instance Method Summary collapse

Instance Method Details

#full_stringObject



38
39
40
# File 'lib/auditing.rb', line 38

def full_string
  strftime("%A %d %B %Y")
end

#show(format = nil) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/auditing.rb', line 29

def show(format = nil)
  case format
  when :human
    strftime("%d-%m-%Y")
  else
    to_s
  end
end

#to_datetimeObject



25
26
27
# File 'lib/auditing.rb', line 25

def to_datetime
  DateTime.civil(self.year, self.mon, self.day)
end

#to_gmObject



17
18
19
# File 'lib/auditing.rb', line 17

def to_gm
  Time.gm(year, month, day).to_datetime
end

#to_localObject



21
22
23
# File 'lib/auditing.rb', line 21

def to_local
  Time.local(year, month, day).to_datetime
end

#to_time(form = :utc) ⇒ Object



13
14
15
# File 'lib/auditing.rb', line 13

def to_time(form = :utc)
  Time.send("#{form}", year, month, day)
end