How to Write a Ruby C Extension (Step-by-Step)

Writing a C extension allows you to interact with Ruby from C. You may want to this if there is a particular important method you would like to optimize with the speed of C, or if you would like to create an interface between a C library and Ruby. An alternative would be to use … Read more

What Are Ruby Symbols & How Do They Work?

A symbol looks like this: Some people confuse symbols with variables, but they have nothing to do with variables… …a symbol is a lot more like a string. So what are the differences between Ruby symbols & strings? Strings are used to work with data. Symbols are identifiers. That’s the main difference: Symbols are not … Read more

Functional Programming In Ruby (Complete Guide)

Maybe you just heard about functional programming & have some questions. Like… What is functional programming exactly? How does it compare to object-oriented programming? Should you be using functional programming in Ruby? Let me answer these questions for you so you can get a better idea of how this works. What Is Functional Programming? It’s … Read more

Ruby String Methods (Ultimate Guide)

A string is a sequence of characters. Strings are objects so they have a lot of methods you can use to do things with them. In this article… You’ll discover the most useful Ruby string methods with examples! How to Get The String Length Easy: You can also use length, instead of size, they do … Read more

Everything You Need to Know About Nil

Nil… What is it, really? Well, nil is a special Ruby object used to represent an “empty” or “default” value. It’s also a “falsy” value, meaning that it behaves like false when used in a conditional statement. Now: There is ONLY one nil object, with an object_id of 4 (or 8 in 64-bit Ruby), this … Read more