Class: Date

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

Instance Method Summary collapse

Instance Method Details

#full_stringObject



41
42
43
# File 'lib/mordor.rb', line 41

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

#show(format = nil) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/mordor.rb', line 32

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

#to_datetimeObject



28
29
30
# File 'lib/mordor.rb', line 28

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

#to_gmObject



20
21
22
# File 'lib/mordor.rb', line 20

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

#to_localObject



24
25
26
# File 'lib/mordor.rb', line 24

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

#to_time(form = :utc) ⇒ Object



16
17
18
# File 'lib/mordor.rb', line 16

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