Solving the N-Queens Problem With Ruby

N-Queens is an interesting coding challenge where you have to place N queens on a N * N board. It looks like this: A queen can move in all directions: Vertical Horizontal Diagonal The solution (there can be many) must place all the queens on the board & every queen must be out of reach … Read more

Ruby Sets – Examples, Operators & Methods

What is a Ruby set? A set is a class that stores items like an array… But with some special attributes that make it 10x faster in specific situations! On top of that: All the items in a set are guaranteed to be unique. In this Ruby tutorial you’ll learn: How & when to use … Read more

The Ultimate Guide to HTTP Requests in Ruby

If you’d like to get information from a website, or if you’d like to submit forms, upload files, etc. You’ll need to send an HTTP request & then process the response. In this article you’ll learn how to: Let’s do this! How to Send an HTTP Request Ruby comes with a built-in http client, it’s … Read more

The Definitive RSpec Tutorial With Examples

Would you like to learn how to write tests for your Ruby applications using RSpec? Then you’re in the right place! In this tutorial I’ll show you how to do that. Contents Why Should You Write Tests? Here’s why: It builds a safety net against errors (especially useful for refactoring) If you don’t have a … Read more

Everything You Need to Know About Ruby Operators

Ruby has a lot of interesting operators. Like: The spaceship operator (<=>) The modulo assignment operator (%=) The triple equals (===) operator Greater than (>) & less than (<) Not equals (!=) What you may not realize is that many of these operators are actually Ruby methods. This means… You can overwrite what they do … Read more