Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/david/extensions.rb
Instance Method Summary collapse
Instance Method Details
#to_datetime_safe ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/david/extensions.rb', line 4 def to_datetime_safe lowercase = self.downcase if 'yesterday' == lowercase return Time.zone.yesterday elsif 'today' == lowercase return Time.zone.today end begin Time.zone.parse self rescue ArgumentError nil end end |