Class: Date
- Inherits:
-
Object
- Object
- Date
- Defined in:
- lib/mordor.rb
Instance Method Summary collapse
- #full_string ⇒ Object
- #show(format = nil) ⇒ Object
- #to_datetime ⇒ Object
- #to_gm ⇒ Object
- #to_local ⇒ Object
- #to_time(form = :utc) ⇒ Object
Instance Method Details
#full_string ⇒ Object
40 41 42 |
# File 'lib/mordor.rb', line 40 def full_string strftime("%A %d %B %Y") end |
#show(format = nil) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/mordor.rb', line 31 def show(format = nil) case format when :human strftime("%d-%m-%Y") else to_s end end |
#to_datetime ⇒ Object
27 28 29 |
# File 'lib/mordor.rb', line 27 def to_datetime DateTime.civil(self.year, self.mon, self.day) end |
#to_gm ⇒ Object
19 20 21 |
# File 'lib/mordor.rb', line 19 def to_gm Time.gm(year, month, day).to_datetime end |
#to_local ⇒ Object
23 24 25 |
# File 'lib/mordor.rb', line 23 def to_local Time.local(year, month, day).to_datetime end |
#to_time(form = :utc) ⇒ Object
15 16 17 |
# File 'lib/mordor.rb', line 15 def to_time(form = :utc) Time.send("#{form}", year, month, day) end |