Weekly tips

Squadracer shares a tip every week. We start this series in Ruby!

RbConfig

A little-documented module

Alexandre Borderes
Alexandre Borderes

grep

Yes, we're talking about Ruby, not the command-line utility!

Alexandre Borderes
Alexandre Borderes

minMAX

We thought we knew them, but we discovered some subtleties!

Alexandre Borderes
Alexandre Borderes

"s l i c e"

String manipulation in Ruby is very advanced. With the `[]` method or its alias `slice`, it's easy to extract a complex part!

Alexandre Borderes
Alexandre Borderes

*[splat operator]

The splat operator is a handy way of manipulating arrays and arguments.

Alexandre Borderes
Alexandre Borderes

Float precision

Float precision is not infinite. Depending on your use case, you need to be very careful.

Alexandre Borderes
Alexandre Borderes

round(half:)

Rounding in Ruby doesn't work like it does in Python, but you can customize it to change that behavior

Alexandre Borderes
Alexandre Borderes