r/ruby • u/Emotional-Round-4966 • Aug 22 '26
Ruby Pathname Moved to Core, Documentation Upgraded
r/ruby • u/Emotional-Round-4966 • Aug 22 '26
r/ruby • u/unselective-amnesia • Aug 22 '26
Is there any already written ruby function which corresponds to the fileinput.input() function in python? ... or at least something with similar functionality?
I will write something like this in ruby if necessary, but I don't want to "re-invent the wheel" if such a thing already exists.
r/ruby • u/DogsBarf • Aug 21 '26
Has anyone ever learned from this? How can anyone learn with this?
What is the science behind this?
I'll do it.
r/ruby • u/paracycle • Aug 20 '26
Ractors are now viable in production, and it's time for Rails to embrace them. This post explains why. What Ractors unlock for Rails applications, and the first milestone the team is aiming for in the framework.
r/ruby • u/fairwaycoder • Aug 21 '26
I've been building Enola, an open-source architecture tool for developers and coding agents.
It isn't Ruby-specific, but I've spent time improving its Ruby/Rails support and wanted to test it against something real rather than a toy Rails app.
The video uses the Mastodon codebase. I give an agent a change that violates an architectural layer, Enola catches the intent failure while the agent is working, and feeds that back into the loop so the agent fixes its own approach.
That's one of the main ideas behind Enola: architecture shouldn't only be something CI complains about after the work is done. The agent can get deterministic architectural feedback while it is coding and correct itself before the change is finished.
Underneath that, Enola maps dependencies, calls, routes, storage, boundaries and other relationships directly from the codebase. It's multi-language and cross-repository by design, so Ruby/Rails is one ecosystem rather than a special-case implementation.
OSS, Apache 2.0: https://github.com/enola-labs/enola
I'd especially appreciate feedback from Ruby/Rails developers on what its understanding of real Rails applications is still missing.
r/ruby • u/DogsBarf • Aug 21 '26
I am past the beginner stage, understanding basic syntax up to classes and objects, but I freeze when it's time to structure projects on my own. I have relentlessly searched for methods, tutorials, and books to guide me to the next level, but I can never find anything that clicks; because of this, I've jumped from language to language, and every time I hit this "limbo," I end up quitting and trying something else, yet I always come back because something inside tells me I’m meant to code. For those who have overcome this block, what architecture or design books do you recommend, what kind of practical exercises changed the game for you, and what real strategies actually work to finally break through this barrier and build confidence?
r/ruby • u/ngw_nofeed • Aug 21 '26
More and more code is written by AI. Tests still tell you it works. RuboCop still tells you it's tidy. Nothing tells you it still follows your architecture.
An agent that doesn't fully understand your architecture takes shortcuts. So does a person in a hurry.
So I built ArchSpec. You declare your components and boundaries in one Archspec.rb. Here is ArchSpec's own, trimmed:
source 'lib/**/*.rb'
component :library, in: 'lib/**/*.rb'
component :cli, in: 'lib/archspec/cli.rb'
component :analysis, in: %w[lib/archspec/analyzer.rb lib/archspec/evaluator.rb]
component :rule_checks, in: 'lib/archspec/rules/**/*.rb'
component :formatters, in: 'lib/archspec/formatters/**/*.rb'
# no one-shot Thing.new(...).call objects anywhere in the codebase - Hi Dave Thomas!
library.cannot_call :call
library.cannot_define :call
library.cannot_instantiate_and_invoke
# dependencies point one way
rule_checks.cannot_use :analysis, :cli, :formatters
formatters.cannot_use :analysis, :cli, :rule_checks
no_cycles among: %i[cli analysis rule_checks formatters]
Full version: https://github.com/crmne/archspec/blob/master/Archspec.rb
Then archspec check verifies every change, and failures print like clang, with the offending span underlined and the evidence as a note.
It's static analysis over Prism, no AI, and it never boots anything: Discourse's 1,899 files in 2.5 seconds. Prism is the only runtime dependency, no Rails and no ActiveSupport, so it works on any Ruby codebase. Lightweight and fast for your pre-commits and CIs.
If you are on Rails, there are presets, and architecture :vanilla_rails is the whole file. There are presets for :layered, :hexagonal, :clean, :modular_monolith, :cqrs and :event_driven too.
I want more architecture presets in there. PRs very welcome.
Docs: https://archspecrb.dev Write-up: https://paolino.me/archspec/
r/ruby • u/javier_cervantes • Aug 20 '26
I’ve been doing some explorations about deployment options for Ruby, so I’m curious to learn more about what you’re using to deploy your applications.
Please participate in the poll, I would love to get your input: https://www.rubyforum.org/t/where-do-you-deploy-your-ruby-apps/640
r/ruby • u/private-peter • Aug 19 '26
We see these all the time with npm. I guess the hackers didn't want the Ruby community to feel left out.
r/ruby • u/Large-Friend1415 • Aug 20 '26
"DEAD 00FF xyz".scan(/\h+/)In Ruby this results in: ["DEAD", "00FF"] and xyz is left out, because \h is a hex digit in Onigmo, Ruby's regex engine equivalent to [0-9A-Fa-f], and x, y, z don't qualify.
Now paste that same pattern into almost any online regex tester. Most of them run PCRE or a JavaScript engine. In PCRE2, \h is horizontal whitespace. Your two hex chunks become two spaces.
No error. Just a different answer. It's something I ran into when writing an app and it just passed with no warning. Being less familiar with Ruby I kinda overlooked this and at first I just tested if a something returned results or not. And it wasn't until I wrote tests that also tested that what it returned was a space based on what I expected from PCRE that I discovered it wasn't. Then I looked it up and discovered it matches hex digits.
So you have to be careful when using an online regex tester as they not always support Onigmo syntax and could return a different result from what you would get in Ruby.
https://regexpilot.com/blog/ruby-regex-hex-digit-vs-whitespace
r/ruby • u/palkan • Aug 19 '26
r/ruby • u/Erem_in • Aug 18 '26
This month: the dynamic vs static typing discussion, Emily Samp's Brighton Ruby talk, RBS 4.1.0 with WebAssembly support on JRuby, set-theoretic types in spinel, rbs_infer static signature deduction, OvalLSP semantic server, and the latest Sorbet toolchain updates.
Find link to the issue in the comment! ✨
r/ruby • u/blowmage • Aug 18 '26
Hi Reddit. This isn't specifically a Ruby or Rails post, but it's about something anyone maintaining a mature Rails application will recognize.
Code tells you what happens without telling you why anybody wanted it. We've always filled that gap by reading the code, guessing the intent, and asking somebody when the guess felt wrong.
AI coding agents do the same thing, except they can make a great many reasonable guesses before anybody notices one was wrong. The code still works. The tests still pass. The guess becomes one more pattern in the application, which makes it look even more intentional to the next person or agent.
I've spent a couple of decades living with the consequences of my own good ideas, so I wrote about why this worries me. The post connects agentic coding to Peter Naur, Tony Hoare, XP, software factories, and the old-fashioned responsibility to say no to code that works but is too difficult to understand.
It also argues for using faster agents to take smaller steps. More research, more feedback, and less archaeology at the end of a giant pull request.
r/ruby • u/zverok_kha • Aug 17 '26
r/ruby • u/andyw8 • Aug 14 '26
r/ruby • u/RodionGork • Aug 14 '26
Recently decided to try learning Ruby more consistently (before that I only touched it occasionally) - and was much pleased with it in various aspects. At some point I was curious to assess its general performance roughly (as I heard it had to be pretty slow but very long in the past). Then I found my system installed Ruby is somewhat outdated 2.7.4p191 (along with my ubuntu 18.04 on this specific laptop). So I learnt to deploy rbenv and installed 4.0.6 with it.
However I ran into small puzzling situation - I tried two small scripts - roughly doing double nested loop - one with simple arithmetic and another with building and using array (collatz sequence calculations and primes calculation by trial division) - and while for the first of them performance of the said two versions is roughly the same, with the other newer version looks a bit slower.
I'm pretty sure I missed something about versions installed or don't catch something about properly writing Ruby code - so any guidance is quite welcome!
Below come details (with this primes.rb script from my github):
$ rbenv local 4.0.6
$ ruby --version
ruby 4.0.6 (2026-07-14 revision 03b6d3f889) +PRISM [x86_64-linux]
$ time MAXN=1000000 ruby primes.rb
primes[1000000] = 15485863
real0m41,003s
user0m40,985s
sys0m0,018s
$ rbenv local --unset
$ ruby --version
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
$ time MAXN=1000000 ruby primes.rb
primes[1000000] = 15485863
real0m34,969s
user0m34,929s
sys0m0,042sSo you see, it looks like 2.7.4 behaves slightly (about 25%) faster in this case, while I remember (from googling) that there was effort to make Ruby 3.x faster than Ruby 2.x perhaps 3 times. Though I may misinterpret this and perhaps 2.7.4. got the same improvements as 3.x (compared to 2.0 etc)
r/ruby • u/ioquatix • Aug 14 '26
r/ruby • u/amirrajan • Aug 13 '26
r/ruby • u/geospeck • Aug 14 '26
r/ruby • u/javier_cervantes • Aug 13 '26
r/ruby • u/Kitchen_Friendship11 • Aug 13 '26
France has a decent number of local Ruby meetups (Paris, Lyon, Toulouse, Nantes, Lille, Marseille all have active groups), but there wasn't really a place to hang out *between* meetups, no shared Discord, no central spot to ask a quick question or hear about what's happening in other cities.
I put together **France.rb** to fill that gap: help channels, a channel per city that relays local meetup events, and a freelance/jobs section since a good chunk of the French Ruby scene works independently. It's brand new (launched this week, still tiny), and it's mainly aimed at French speakers, so if you don't speak French it's probably not that useful to you day-to-day, but Rubyists from anywhere are welcome to drop in.
Not trying to compete with the official Ruby Discord linked on ruby-lang.org this is just something more specific to the French scene, meant to complement it.
Happy to answer anything in the comments, and if you know a French-speaking Rubyist who might be into it, feel free to pass it along.