(maximum_number_of_students <=> students.size).clamp(0..)
Holy... Is this better or worse than write-once perl regexes? (maximum_number_of_students <=> students.size).clamp(0..)
Holy... Is this better or worse than write-once perl regexes?But then I realized that's nonsensical, and not what the code is supposed to do given the usage in the template. I assume something got mangled there when changing the code for the blog post.
Or I'm just understanding the ruby code wrong despite checking just now in irb, in that case that's a point for the intention of your comment, and a vote for "worse".
[maximum_number_of_students - students.size, 0].maxNeedlessly ugly way to write it imo though
I think they tried to be a bit too clever, basically.