Systems | Development | Analytics | API | Testing

Ruby

What's new in Ruby 3.4

According to Ruby tradition, the core team will release Ruby 3.4 on December 25—but the preview has been out since May! If you're anticipating the release like we are, you're probably wondering what's new in Ruby 3.4. There aren't any huge changes in this release, but you'll want to be aware of a few really cool things. Let's dig into some of the language changes first.

Server-sent Events and WebSockets in Rack for Ruby

In the previous part of this series, we discovered how to create persistent connections in Rack in theory, but now we'll put what we learned into practice. The web has two formalized specifications for communication over a persistent connection: server-sent events (SSEs) and WebSockets. WebSockets are widely used and highly popular, but SSEs are far less well-known. Let's explore them first.

The Basics of Rack for Ruby

Rack is the foundation for every popular Ruby web framework in existence. It standardizes an interface between a Ruby application and a web server. This mechanism allows us to pair any Rack-compliant web server (such as Puma, Unicorn, or Falcon) with any Rack-compliant web framework (like Rails, Sinatra, Roda, or Hanami). Separating the concerns like this is immensely powerful and provides a lot of flexibility. It does, however, also come with limitations.

The ultimate guide to Sidekiq scheduled jobs

Sidekiq is one of the most popular open-source background job libraries for Ruby. As one of ActiveJob's most popular backends, it's often used to run asynchronous jobs in Rails applications. It leans on Redis to manage queues and jobs, which makes it fast. Developers can run background jobs using Sidekiq with or without ActiveJob, and we'll explore both in this article. Just as useful - Sidekiq scheduled jobs allow you to run a job after a given amount of time or at a given time.

A practical guide to web scraping with Ruby

One of the benefits of Ruby's developer-friendly syntax is that it's straightforward to quickly build scripts to automate tasks. Web scraping with Ruby is fun, useful, and straightforward. In this article, we'll explore using HTTParty to pull a web page and check it for a given string. To be specific, we'll build a cron job in Ruby to check if a product is in stock on a website!

Ruby's hidden gems: Sorbet

The debate between static and dynamically typed languages has long been a subject of contention among developers. Each approach offers its own set of advantages and disadvantages, significantly influencing the software development process. Dynamically typed languages like Ruby provide flexibility by allowing variables to be declared without corresponding types. This approach fosters rapid development and promotes an agile process.

How to Use Azure Blob Storage with Ruby on Rails

Azure Blob Storage is an object storage service that is very similar to AWS S3. ActiveStorage from Rails has built-in support for both ActiveStorage and S3 for file storage, making it easy to integrate and even swap out providers. The Honeybadger Blog has already explored using S3 for file storage in Rails, and in this article, we'll explore using Azure to allow users to upload files in a Rails application. You can find the final code here on Github.

Ruby on Rails 7.1: Partial Strict Locals and Their Gotchas

Rails partials have been around for years, but they can be clunky since they're just ERB snippets without a backing object structure. Recently, libraries like ViewComponent and Phlex have tried to improve the view layer by adding more semantic structure to the templates. These are great libraries and I personally reach for ViewComponent on almost every project I work on. That said, I still feel the humble Rails partial still works great for many use cases.

An Introduction to Nix for Ruby Developers

A predictable, stable environment (in terms of your operating system, system libraries, build tools, and programming libraries) is essential to each development step: from onboarding, to collaboration, continuous integration, quality assurance, and deployment. Deviation can cause one-off, intermittent, and even catastrophic failures. However, consistency can be elusive, even with the best intentions, best practices, and tools in place, because: Nix aims to solve some of these issues.