[LRUG] Comparable Null Objects
Paul Makepeace
paulm at paulm.com
Thu Jul 16 16:53:38 PDT 2015
On Thu, Jul 16, 2015 at 3:24 PM, Stephen Best <bestie at gmail.com> wrote:
>
> events.sort_by { |e|
> e.date { heat_death_of_the_universe }
> }
>
This to me is the clearest of the proposals (Tom's role idea is cool too).
For a null object you could also use... nil
events.sort_by { |e|
e.date || date_that_sorts_at_the_end # (named to be clearer about intent)
}
The whole discussion has been really interesting!
Paul
More information about the Chat
mailing list