[HN Gopher] Class methods are Ruby's useEffect
___________________________________________________________________
Class methods are Ruby's useEffect
Author : monkey_slap
Score : 12 points
Date : 2024-10-17 19:19 UTC (3 hours ago)
(HTM) web link (www.campsite.com)
(TXT) w3m dump (www.campsite.com)
| gerjomarty wrote:
| As an aside, if you need to play with datetime objects in Ruby,
| you almost certainly want to be using the Time library instead of
| the DateTime library, even though one of them sounds like it fits
| better.
|
| At the top of the DateTime docs [1]:
|
| > DateTime class is considered deprecated. Use Time class.
|
| The same doc explains when you should use DateTime by using an
| anecdote about William Shakespeare and Miguel de Cervantes dying
| on the same day - except they didn't because England and Italy
| used different calendars at the time. [2]
|
| DateTime is great at dealing with historical pre-1970 dates,
| otherwise just use Time.
|
| [1]: https://docs.ruby-lang.org/en/3.3/DateTime.html [2]:
| https://docs.ruby-lang.org/en/3.3/DateTime.html#class-DateTi...
___________________________________________________________________
(page generated 2024-10-17 23:01 UTC)