How to Use The Ruby Map Method (With Examples)

Map is a Ruby method that you can use with Arrays, Hashes & Ranges. The main use for map is to TRANSFORM data. For example: Given an array of strings, you could go over every string & make every character UPPERCASE. Or if you have a list of User objects… You could convert them into … Read more

How To Delegate Methods in Ruby & Ruby on Rails

This article is about method delegation in Ruby. You’re going to learn how to use the delegate method, the Forwardable module & the SimpleDelegator class. Why do we need delegation? In Object-Oriented Programming, there are two ways for classes to work together. They are: Inheritance Composition With inheritance, you create class hierarchies, where a parent … Read more

Ruby Gems, Gemfile & Bundler (The Ultimate Guide)

What is a Ruby gem? A gem is a package that you can download & install. When you require an installed gem you’re adding extra functionality to your Ruby program. Gems allow you to: Add a login feature to your Rails app Easily work with external services (like APIs) Build a web application That’s just … Read more