Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/utiles_datetime.rb
Overview
Extentions for Time class.
Instance Method Summary collapse
-
#to_str(*splat) ⇒ Object
Formats Time object to string.
Instance Method Details
#to_str(*splat) ⇒ Object
Formats Time object to string.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/utiles_datetime.rb', line 11 def to_str(*splat) if splat.empty? localtime.strftime("%Y-%m-%d / %H:%M:%S") else case splat[0] when :minutes localtime.strftime("%Y-%m-%d / %H:%M") when :date localtime.strftime("%Y-%m-%d") else localtime.strftime("%Y-%m-%d / %H:%M:%S") end end end |