3 Awesome Ways To Use Ruby’s Gsub Method

Let’s talk about Ruby’s gsub method & how to use it. First, you’ll need a string to play with this method. Why? Because the whole point of gsub is to replace parts of a string. In fact: The “sub” in “gsub” stands for “substitute”, and the “g” stands for “global”. Here is an example string: … Read more

How to Use The Ruby Sequel Gem (With Examples)

What is Sequel? Sequel is a gem that allows you to access your database, no Rails required. You can connect to your database in different ways. Mostly two: By sending raw SQL commands By using an ORM Here’s an example, using raw SQL & the MySQL database. require ‘mysql2’ client = Mysql2::Client.new(host: “localhost”) results = … Read more