Ruby Cheat Sheet

Cheat sheet and tricks for the Ruby programming language.

Examples

hello.rb – Hello World

puts "Hello World"

Run Ruby in a container

Prerequisite: Docker

Start the container

$HOME from the host will be available under /lisandre in the container

docker run -ti -v $HOME:/lisandre --rm ruby bash

Run Ruby script

ruby /lisandre/hello.rb

Stop and remove the container

exit
docker ps -a
docker rm <id>