ruby

Jul
02

TIL: How to Prettify Ruby's inject Method

Using each_with_object over inject
Jul
01

TIL: How to Quickly Get Regex Matches in Ruby

I often want to get the string from a regex match. If I'm only bothered about getting the first match, this shorthand works
Jun
30

TIL: You Can Use Lambdas in Ruby Case Statements

Using lambdas inside Ruby case statements
Jun
29

TIL: Ruby Knows the Source of Required Code

There's a magic variable which, if initialised, will contain the source of all the files imported afterwards
Jun
28

TIL: Using File Locking for Exclusivity in Ruby

Two TILs in one, how to use native file locking to prevent more than one process running at the same time
1 min read
Jun
27

TIL: Ruby Has a Built-in Persistance Database

Did you know Ruby has a built-in database?
1 min read
Jun
26

TIL: Ruby Associative Arrays

Using arrays as if they had keys
1 min read
Jun
25

TIL: Automatic Deep Keys with Ruby Hashes

Generate keys automatically for building deep hashes quickly. Best explained with an example.
Jun
24

TIL: Named Structs

Named structs in Ruby
Jun
23

TIL: Matching Multiple Values in a Case Statement

Matching more than one value in a case statement