Ruby Icon

Ruby

Ruby is a scripting language designed for simplified object-oriented programming.
331 Stories
All Topics

Docker mrsk.dev

MRSK – deploy web apps anywhere

MRSK deploys web apps anywhere from bare metal to cloud VMs using Docker with zero downtime. It uses the dynamic reverse-proxy Traefik to hold requests while the new application container is started and the old one is stopped. It works seamlessly across multiple hosts, using SSHKit to execute commands. It was built for Rails applications, but works with any type of web app that can be containerized with Docker.

Watch the screencast or check out the code & docs.

Justin Searls Test Double

The Standard Ruby VS Code extension

Recent guest Justin Searls announces his new thing:

Standard Ruby (a Ruby style guide with linter & automatic code fixer) now ships with its own built-in language server, which enables it to offer lightning-fast linting and formatting for supported editors. This new extension leverages that language server to deliver a much faster UX than most other Ruby extensions available for VS Code.

I don’t know how many of our readers live at the intersection of VS Code and Ruby… but if you do, this should be great news for you. 😉

Ruby rubyonjets.com

Ruby and Lambda had a baby and that child's name is Jets

Ruby on Jets allows you to create and deploy serverless services with ease, and to seamlessly glue AWS services together with the most beautiful dynamic language: Ruby. It includes everything you need to build an API and deploy it to AWS Lambda. Jets leverages the power of Ruby to make serverless joyful for everyone.

I’m not (yet) big on serverless things, but if I were, I’d love to run some Ruby code there.

Changelog Interviews Changelog Interviews #521

Don't sleep on Ruby & Rails

Welcome to 2023 — we’re kicking off the year talking to Justin Searls about the state of web development and why he just might write a “You Might Not Need React” post. He’s been so productive using Turbo and Stimulus (and tailwind) in Rails 7 that we had to talk about the state of Rails development today and a bunch of other fun topics around building for the web in 2023.

Ruby phlex.fun

A framework for building fast, reusable, testable views in pure Ruby

Phlex views are “plain old Ruby objects” — templates are methods and HTML tags are method calls. If you know how to define a class with a method that calls another method, you know how to use Phlex.

When it comes to API usability, Ruby is so tough to beat. This looks actually fun to use!

class Nav < Phlex::HTML
  def template
    nav(class: "main-nav") {
      ul {
        li { a(href: "/") { "Home" } }
        li { a(href: "/about") { "About" } }
        li { a(href: "/contact") { "Contact" } }
      }
    }
  end
end

Ruby blog.saeloun.com

Ruby adds a new core Data class to represent immutable value objects

Ruby 3.1 adds a new core class called Data to represent simple immutable value objects. The Data class helps define simple classes for value-alike objects that can be extended with custom methods.

While the Data class is not meant to be used directly, it can be used as a base class for creating custom value objects. The Data class is similar to Struct, but the key difference being that it is immutable.

In its heyday, most Rubyists wouldn’t touch immutability with a ten-foot pole. Times, they are a changin’…

Bill Prin billprin.com

Why I ditched Django for NextJS

If you’re feeling the FOMO of JavaScript or you’re writing “spaghetti code” just to do something a NextJS component would do out of the box, then read this post from Bill Prin on why he moved from Django to NextJS.

The summary is that using a language like Python or Ruby for a significant web project has increasingly gotten less reasonable over time to the point where now, in 2022, it’s getting hard to justify. By not keeping your web stack in pure Javascript, you are making your life unnecessarily difficult (as usual, we’ll include languages like TypeScript as part of the JavaScript ecosystem). You will almost certainly invest a bunch of time-solving problems that would be automatically solved for you if you just stuck with JavaScript.

I will provide specific examples of solving problems using Django that would have been trivially solved in NextJS.

He goes on to share two reasons why you should use Python or Ruby for web projects in 2022.

You’re working on an existing project that hasn’t been migrated yet or is not worth migrating.
You are already a master of a Python or Ruby web stack, and you need to implement a new project as soon as possible, and you don’t have time to learn a better stack.

Culture whytheluckystiff.net

_why's Estate

whytheluckystiff.net is back online and now hosts links and mirrors to everything the man published on the internet during his illustrious career.

It works sort of like a museum that sells maps.

If you’ve never heard of why the lucky stiff, click through to get acquainted. If you were fortunate enough (like myself) to be around when he was actively creating things, click through for some top notch nostalgia.

Ship It! Ship It! #61

The ops & infra behind Transistor.fm

Today we talk with two lovely folks from Transistor.fm: Jason Pearl, Senior Software Developer & Jon Buda, co-founder. Gerhard was curious to find out about their setup & how did it change with the launch of the new podcast website builder. After all, you have been hearing us talk about our setup for years, so it was high-time to challenge some assumptions and learn how another team is solving similar problems.

TL;DL: keeping it simple is at the root of smooth operations & stable systems.

JSON github.com

An interactive wrapper around `jq`

Nick Nisi shared this with me recently and it’s cool, so I thought I’d pass it along. Here’s Nick describing it:

And it is a visual wrapper around jq, that kind of does the fzf type thing where as you’re writing out your query, it’s live showing you a preview in virtual text of exactly what would get returned by what you’re querying as you go. So you can use that as a nice tool to build out your jq syntax, or your jq query, and in real time get that feedback.

The only bummer is that it’s written in Ruby. Don’t get me wrong, I love Ruby. But it requires you to have Ruby tooling on your machine to use jqq, which many people don’t have or want. BUT it’s a mere 241 lines of code, so porting it to something a little more portable shouldn’t be too much work…

Gui Heurich code-anth.xyz

Chunky Bacon

Gui Heurich on one of the legends of the Ruby community, _why the lucky stiff.

Through the things that he built, the way he performed, and the books that he wrote, _why makes us think about code and also about ourselves. It makes us think about ourselves as programmers. In a sense, _why was the meta-programmer, the one that generates other programmers by promoting reflexivity.

Ruby dmitrytsepelev.dev

Why Ruby has symbols

Most Ruby engineers know the difference between symbols and strings from a usage perspective. So, in this article I look at them from a different angle.

You’ll learn about a cool compiler optimization called “string interning”, which is used in many languages. Also, you will understand what happens when (almost any) interpreter runs your code, take a look at the AST and take a peak at the symbols interpretation at the low level.

David Heinemeier Hansson rubyonrails.org

Rails 7.0: fulfilling a vision

DHH announcing the 7th major release of Ruby on Rails:

This version of Rails has been years in the conceptual making. It’s the fulfillment of a vision to present a truly full-stack approach to web development that tackles both the front- and back-end challenges with equal vigor. An omakase menu that includes everything from the aperitif to the dessert.

There’s a lot to like about the new Node-free approach to the frontend, at-work encryption added to Active Record, a new auto-loading strategy, and more. Congrats to the hundreds of contributors who worked on this major milestone!

Ruby softwaredoug.com

Ruby vs Python comes down to the for loop

Doug Turnbull breaks down a major difference between two beloved programming languages in how they handle iteration.

Python embraces for. Objects tell for how to work with them, and the for loop’s body processes what’s given back by the object. Ruby does the opposite. In Ruby, for itself (via each) is a method of the Object. The caller passes the body of the for loop to this method.

He goes on to give examples and explain why each approach might map to different developers’ brains… differently. Here’s a succinct summary, if you don’t have time for the deeper discussion:

In Ruby, the objects control the affordances. In Python, the language does.

Evil Martians Icon Evil Martians

A no-go fantasy: writing Go in Ruby with Ruby Next

Svyatoslav Kryukov on the Evil Martian blog:

Ruby is awesome. We love its readability, flexibility, and developer-centric nature. Still, here at Mars, we also love Go because it has its own sense of simplicity and magic, too. Simply put, Go holds advantages over Ruby in some aspects: it’s faster, statically typed, and comes with cool concurrency primitives out of the box. This being said, some intrepid readers might find themselves grappling with a seemingly reasonable question: if Go is so darn good, why don’t we just write everything with it?

Read this tale and learn to write Go in Ruby, gaining the ability to modify Ruby exactly as you desire.

Emma Hyde Medium (via Scribe)

Ruby is still a diamond

Emma Hyde:

I have seen a staggering amount of Ruby is Dead missives in the last few years, and a decline, or at least, an often discussed decline, of the language’s popularity and ranking. But what makes Ruby so much worse than other languages?

She goes on to discuss how Ruby 3.0 addresses two of the most criticized elements of Ruby: its ability to handle processes simultaneously and and its overall performance.

RSS github.com

A GitHub Action to create single-show feeds from your Changelog++ feed

One of our awesome Changelog++ members scratched their own itch:

When you upgrade to Changelog++ you’re given access to ad-free versions of episodes however they’re only available in one giant bucket feed instead of through individual show feeds. Though only around 5 new podcast episodes are published weekly, if you’re coming in as a new listener you’ll have a long backlog list with over one thousand shows. It’s easier to sift through older episodes when they’re organized by show, so that’s what this project provides: individual show feeds.

I love grassroots initiatives like this, but it’s motivating me to bring Changelog++ onsite so we can bake the functionality right in to our platform…

Ruby github.com

A pure-Ruby JIT compiler for Ruby (read it, don't use it!)

This project is no longer actively developed, but it looks like an excellent resource for anyone who is interested in compilers. Ruby is an easy language to grok, so it should make for (relatively) easy reading!

Rhizome is a paedagogical just-in-time compiler (JIT) for Ruby, implemented in pure Ruby. It’s not really designed to be used. It’s designed to show you how JITs work and why perhaps a JIT for Ruby should be written in Ruby. It’s also designed to try to go beyond the trivial aspects of a simple template compiler that introductions to JITs often show - instead it has a proper intermediate representation (IR) and shows how more advanced parts of compilers such as lowering and schedulers work, that people don’t usually cover.

Ruby fastruby.io

Why wasn't Ruby 3 faster?

Noah Gibbs tries to reason through why some folks are disappointed in Ruby 3’s lack of speed improvements:

I think some of the problem was misplaced expectations. People didn’t understand what “three times faster” was supposed to mean. I don’t think people thought it through, but I also don’t think it was communicated very clearly.

So: some people understood what was promised, and some people didn’t.

What was promised?

I think Noah hits on a lot of solid points here.

Ruby github.com

Higher-level Ruby data structures built on Redis

Kredis (Keyed Redis) comes from the Rails team and lets you interact with Redis-backed keys as coherent Ruby objects rather than isolated procedural commands. Here’s what that might look like when dealing with strings, integers, and JSON:

string = Kredis.string "mystring"
string.value = "hello world!"  # => SET mystring "hello world"
"hello world!" == string.value # => GET mystring

integer = Kredis.integer "myinteger"
integer.value = 5  # => SET myinteger "5"
5 == integer.value # => GET myinteger

json = Kredis.json "myjson"
json.value = { "one" => 1, "two" => "2" }  # => SET myjson "{\"one\":1,\"two\":\"2\"}"
{ "one" => 1, "two" => "2" } == json.value  # => GET myjson

(There are also Redis-backed data structures for counters, enums, flags, lists, unique lists, sets, and slots.)

I love the idea of being able to think at the layer of objects instead of database record manipulation. Dark is doing something similar with its persistence engine, which we discuss on an upcoming episode of The Changelog.

The GitHub Blog Icon The GitHub Blog

Bringing React's ideas to server-rendered Rails views

We didn’t do too much coverage of Rails 6.1 release last week, but here’s a great write-up on the GitHub blog about how they landed a couple small PRs into the framework that dramatically changed how the company is building views with ViewComponent.

This comment was particularly noteworthy, methinks:

Inspired by our experience building component-based UI with React, we set off to build a framework to bring these ideas to server-rendered Rails views.

Good ideas propagate. Regardless of what comes next in the web UI world (or React goes from here), this single idea is so profound for building frontends that it will be React’s lasting legacy.

Player art
  0:00 / 0:00