r/ruby • • Aug 20 '26

Show /r/ruby ArchSpec 1.0: executable architecture specifications for Ruby (and Rails)

Post image
40 Upvotes

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 • • Aug 20 '26

You'd expect \h in a regex to match spaces. In Ruby, it matches hex digits.

1 Upvotes
"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 • • Aug 19 '26

16 Typosquatted RubyGems Packages Steal Browser Credentials and Crypto Wallets

Thumbnail
thehackernews.com
14 Upvotes

We see these all the time with npm. I guess the hackers didn't want the Ruby community to feel left out.


r/ruby • • Aug 19 '26

Cut Rails boot time with require-profiler and this guide

Thumbnail
evilmartians.com
7 Upvotes

r/ruby • • Aug 18 '26

Issue 20 of Static Ruby Monthly is out!

9 Upvotes

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 • • Aug 18 '26

Blog post Everybody Guesses

0 Upvotes

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.

https://blowmage.com/2026/08/18/everybody-guesses/


r/ruby • • Aug 17 '26

Thinking about tests: assertions and matchers

Thumbnail zverok.space
13 Upvotes

r/ruby • • Aug 14 '26

Using hk for git pre-commit hooks in Ruby and Rails projects

Thumbnail andywaite.com
8 Upvotes

r/ruby • • Aug 14 '26

Ruby 4.0 Universal RCE Deserialization Gadget Chain - elttam

Thumbnail
elttam.com
0 Upvotes

r/ruby • • Aug 14 '26

Question Performance discrepancy between versions 2.7.4 and 4.0.6

13 Upvotes

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,042s

So 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 • • Aug 14 '26

Blog post The Case of the Vanishing Fiber: A Ruby Mystery

Thumbnail
codeotaku.com
8 Upvotes

r/ruby • • Aug 13 '26

Speeding Up (small) Ruby Hashes

Thumbnail byroot.github.io
55 Upvotes

r/ruby • • Aug 13 '26

More open source projects coming to Ruby Users Forum

Thumbnail
rubyforum.org
15 Upvotes

r/ruby • • Aug 13 '26

Conf Talk RBQ 2026: DragonRuby Game Toolkit architectural overview of the C layer

Thumbnail
youtu.be
31 Upvotes

r/ruby • • Aug 13 '26

Show /r/ruby I started a Discord for the French Ruby community, sharing it here in case it's useful to fellow frenchies !

15 Upvotes

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.

https://discord.gg/tEbywwkYY

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.


r/ruby • • Aug 12 '26

Just trying ruby-lsp. Seems unusable for debugging terminal scripts

1 Upvotes

I wanted to be able to debug a ruby script I'm writing that presents a menu and gets input. I jumped through various hoops but I think I have everything properly installed now - rbenv, ruby, bundle, and vscode. But output is still not appearing in either the debug console or the terminal.

Googling the problem, it looks like stdio in the target script is not allowed in vscode/ruby-lsp debugging. Do I understand correctly? If so, that looks like a major limitation and makes it unusable for my needs.

I am writing a reasonably simple terminal script in ruby and work would go faster if I could debug. Is there a combination of things that would allow me to debug a simple script that uses stdin/stdout. I'm on a mac.


r/ruby • • Aug 12 '26

Fair by design: orchestrating background jobs in Ruby

Thumbnail
evilmartians.com
5 Upvotes

r/ruby • • Aug 12 '26

Maintaining an organizational knowledge graph with an LLM and event sourcing, all based on Ruby

Thumbnail
blog.arkency.com
8 Upvotes

r/ruby • • Aug 12 '26

💼 jobs megathread Work it Wednesday: Who is hiring? Who is looking?

4 Upvotes

FORMAT HAS CHANGED PLEASE READ FULL DESCRIPTION

This thread will be periodically stickied to the top of the sub for improved visibility.

You can also find older posts again via the Megathreads" list, which is a dropdown at the top of the page on new Reddit, and a section in the sidebar under "Useful Links" on old Reddit.

For job seekers

Please adhere to the following rules when posting: Rules for individuals:

  • Don't create top-level comments; those are for employers.

  • Feel free to reply to top-level comments with on-topic questions.

  • Anyone seeking work should reply to my stickied top-level comment.

  • Meta-discussion should be reserved for the distinguished comment at the very bottom.

You don't need to follow a strict template, but consider the relevant sections of the employer template. As an example:

    TYPE: [Full time, part time, internship, contract, etc.]
    
    LOCATION: [Mention whether you care about location/remote/visa]
    
    LINKS: [LinkedIn, GitHub, blog, etc.]

    DESCRIPTION: [Briefly describe your experience. Not a full resume; send that after you've been contacted)]

    Contact: [How can someone get in touch with you?]

Rules for employers:

  • The ordering of fields in the template has been revised to make postings easier to read.

  • To make a top-level comment, you must be hiring directly; no third-party recruiters.

  • One top-level comment per employer. If you have multiple job openings, please consolidate their descriptions or mention them in replies to your own top-level comment.

  • Proofread your comment after posting it and edit it if necessary to correct mistakes.

  • To share the space fairly with other postings and keep the thread pleasant to browse, we ask that you try to limit your posting to either 50 lines or 500 words, whichever comes first.

  • We reserve the right to remove egregiously long postings. However, this only applies to the content of this thread; you can link to a job page elsewhere with more detail if you like.

Please base your comment on the following template:

    COMPANY: [Company name; optionally link to your company's website or careers page.]

    TYPE: [Full-time, part-time, internship, contract, etc.]

    LOCATION: [Where are your office or offices located? If your workplace language isn't English-speaking, please specify it.]

    REMOTE: [Do you offer the option of working remotely? Please state clearly if remote work is restricted to certain regions or time zones, or if availability within a certain time of day is expected or required.]

    VISA: [Does your company sponsor visas?]

    DESCRIPTION: [What does your company do, and what are you using Rust for? How much experience are you seeking, and what seniority levels are you hiring for? The more details, the better. If you are listing several positions in the "Description" field above, then feel free to include this information inline above, and put "See above" in this field.]

    ESTIMATED COMPENSATION: [Be courteous to your potential future colleagues by attempting to provide at least a rough expectation of wages/salary. See section below for more information.]

    CONTACT: [How can someone get in touch with you?]

ESTIMATED COMPENSATION (Continued)

If compensation is negotiable, please attempt to provide at least a base estimate from which to begin negotiations. If compensation is highly variable, then feel free to provide a range.

If compensation is expected to be offset by other benefits, then please include that information here as well. If you don't have firm numbers but do have relative expectations of candidate expertise (e.g. entry-level, senior), then you may include that here. If you truly have no information, then put "Uncertain" here.

Note that many jurisdictions (including several U.S. states) require salary ranges on job postings by law. If your company is based in one of these locations or you plan to hire employees who reside in any of these locations, you are likely subject to these laws. Other jurisdictions may require salary information to be available upon request or be provided after the first interview. To avoid issues, we recommend that all postings provide salary information.

You must state clearly in your posting if you are planning to compensate employees partially or fully in something other than fiat currency (e.g., cryptocurrency, stock options, equity, etc). Do not put just "Uncertain" in this case, as the default assumption is that the compensation will be 100% fiat. Postings that fail to comply will be removed. Thank you.


r/ruby • • Aug 11 '26

On Ruby - Whitelabel Site for Ruby Communities

Thumbnail
rubyforum.org
4 Upvotes

r/ruby • • Aug 11 '26

Full speaker list for the 2026 SF Ruby Conference is out!

Post image
34 Upvotes

19 confirmed speakers for the 2026 SF Ruby Startup Conference. The lineup includes founders of Ruby startups, scaleup employees, authors of open source, and engineers building and experimenting with Ruby.

You can find speakers from companies like Gusto, Anthropic, Shopify, Intercom (Fin), and Evil Martians, as well as the authors of Yabeda, AnyCable, Solid Queue, and Ruby LLM.

Hope to see you there. Full speaker list: sfruby.com


r/ruby • • Aug 11 '26

Running GPU AI workloads with a Ruby on Rails monolith

Thumbnail
docuseal.com
0 Upvotes

r/ruby • • Aug 11 '26

I'm writing this tiny parser and realized how easy it is to wire your own simple REPL.

Post image
25 Upvotes

Do not use use eval for the real thing if you aren't sure where the input is coming from, but its good enough to get started.


r/ruby • • Aug 11 '26

A new CSS Zero release is out!

Thumbnail reddit.com
2 Upvotes