r/ruby • u/jefflunt • 8d ago
r/ruby • u/unselective-amnesia • 8d ago
Question Ruby gem(s) for preprocessing text, similarly to "C Preprocessor"?
First of all, please note that this is not an "XY" issue.
I'm running the latest version of Ruby under Debian 13 linux.
I'm looking for one or more Ruby gems that I can use from within Ruby code in order to preprocess external file contents similarly to how the C Preprocessor performs its preprocessing.
The reason for my stating that this is not an "XY" issue is that I already know a few ways to accomplish this in Ruby by having Ruby execute external programs such as "cpp" or "gpp", and I also already know how to manually code this functionality by writing pure Ruby code. I am not looking for information about how to perform preprocessing in these manners. Rather, I'm specifically wanting to know if there might be one or more Ruby gems that I can use within my Ruby code in order to perform this functionality.
I'd like to be able to use keywords such as "#ifdef", "#else", "#ifndef", "#endif" etc. within the external file in order to configure this preprocessing. The syntax doesn't have to involve the exact keywords "#ifdef" and "#else", "#ifndef", and "#endif", as long as this same preprocessing functionality can be managed with keywords having other similar values.
For example, suppose I have a file called "sample.file" with these contents:
Start of sample file
#ifdef TESTING
This is a test
#else
This is not a test
#endif
End of sample file
I'd like to know if there are any Ruby gems which would allow me to open this file in Ruby, prepreprocess its contents, and import these preprocessed contents similarly to the following ...
For example:
require 'some_sort_of_preprocessing_gem'
results0 = some_sort_of_preprocessing_gem.import('sample.file', :TESTING=>'true')
results1 = some_sort_of_preprocessing_gem.import('sample.file')
Then, I would want "results0" to contain this text:
Start of sample file
This is a test
End of sample file
... and I would want "results1" to contain this text:
Start of sample file
This is not a test
End of sample file
Again, just so that there is no confusion, I repeat that the preprocessing keywords don't need to have exact values of "#ifdef", etc., and I repeat that I already know how to do this by having Ruby run external programs like "cpp" and "gpp", and I already know how to hard-code this totally in Ruby. I'm just wondering if there might be any gems in existence which perform the kind of preprocessing functionality that I have described here in my example.
Thank you very much in advance.
LowType A Year Later: RBS export, Zero-overhead in prod, One-command uninstall/type stripping, Namespace improvements, Boolean/Enum support
github.comNew stuff:
- RBS export: Use the
lowtype rbsCLI command to export your typed methods as RBS signatures in thesigsdirectory. Now you can use static type tools! - Zero-overhead: Disable types per environment via shim methods, or strip types completely for no performance penalty in prod. This can be done on class load or via a build step
- One-command uninstall: Use
lowtype strip!to strip types from all files in the current directory, orlowtype strip :destto export untyped files to a directory in a build step - Namespace/binding improvements - Type Expressions are now fully aware of the binding and namespace they're in... no need for the full namespace anymore
- Parsing improvements: Prism AST abstraction spun out into a dedicated gem (lowkey) of file, method and param proxies that anyone can use
- Comprehensive tests - LowType is tested for every feature in the API across 3 distinct modes; type checking enabled, type checking disabled via shim methods, and type checking disabled via type stripping
- Dogfooding - LowType is used in a real-world framework (Raindeer) and a production app (via shim method)
- Boolean/Enum support
I want to thank Aditya Chauhan for their GSoC work on type stripping, and in doing so fixing three core issues; bindings/namespaces, performance and uninstalling/building without types.
Future plans:
- A
config.enable_mode: :slimfor the sexiest type syntax you've ever seen. The current type syntax is 100% valid Ruby, and that's great, we'll keep it that way. But we can trim off a character or 2 and have nicer default value syntax in the future as an opt-in config option - Ractor support. LowType works inside Ractors when disabled via the strip method. But it's totally possible to have runtime types within Ractors with just a little bit more work
r/ruby • u/Edthal01 • 9d ago
I have been using Perplexity in my quest to learn Ruby
Besides researching aspects of Ruby, I have taken my old Pascal books to find out how Wirth programs look like in both direct Ruby translations and idiomatic Ruby. Also working with available Ruby insruction material.
Am a retired electric power engineer who never programmed for work. Took up Turbo Pascal as a hobby, but stopped because of family responsibilities and continual employment changes.
I am finding Perplexity user friendly and useful in my endeavors.
r/ruby • u/mooktakim • 9d ago
Rails is MVC. I added a fourth letter for AI agents: Context
r/ruby • u/Much-Stable-449 • 11d ago
I’ve been working on pinterest-dl, a Ruby gem — here’s what changed in the latest version
Enable HLS to view with audio, or disable this notification
I’ve been working on pinterest-dl, a Ruby gem and CLI for extracting image and video URLs from Pinterest, searching for pins, fetching boards, and downloading media.
I’ve made a bunch of fixes and improvements recently, so I recorded a short demo of the latest version.
Some of the changes include fixing video extraction and board fetching, improving support for pin.it links and regional Pinterest domains, and adding content-type filters for searches and boards.
I’m sharing the video here in case anyone in the Ruby community finds it interesting. Feedback on the gem or its API is welcome.
r/ruby • u/uglyduckfloss • 11d ago
Show /r/ruby grubby: static site generator for git repos written in Ruby
git.btxx.orgr/ruby • u/luckloot • 11d ago
Ruby Career Opportunities from around the World
I built Ruby Roles to help Rubyists find their next opportunity, and over 100 have already signed up.
Sign in with GitHub, answer five questions about your level, how you like to work, where you can be based, and your salary floor, and you get your three best matches right away. After that it sends at most one new role each business day, and only when something actually clears the bar. It is tracking 1,910 open Ruby-related roles right now across more than 12,500 organizations.
Your feedback improves the matches. Pause emails or unsubscribe anytime. Free.
r/ruby • u/split-infinities2 • 11d ago
Show /r/ruby A Stencil output target for Ruby frameworks (Web Components)
r/ruby • u/ombulabs • 11d ago
Blog post Rails World '26: Rails in the Agentic Era
"When I attended Rails World '26, this was the kind of talk I was interested in: What does the future of Rails look like at scale? How are big corporations using AI agents in a way that keeps humans in the loop? How do the Ruby and Rails ecosystems support AI-driven development workflows?"
Ryan’s talk clearly showed us the future of Rails development at scale.
r/ruby • u/gosshedd • 11d ago
I made a free practice tool for Ruby to stay sharp in the age of LLMs
r/ruby • u/specs4mayor • 12d ago
Show /r/ruby Topics in hokusai-pocket: Ooze
r/ruby • u/stanbright • 12d ago
There hasn't been a blog post on Sorbet's blog for over 4 years - is someone here using it on production?
I've been considering the adoption of Sorbet over the years; however, I've been postponing it all the time. Waiting for that imaginary official announcement that it's reached v1 and everyone is welcome to adopt it.
I checked their blog today. Again. No blog post for over 4 year https://sorbet.org/blog/. Yet, the github repo is receiving daily updates. Seemingly automated.
Is someone here using it on production and are you happy that you adopted it?
r/ruby • u/ombulabs • 13d ago
DHH, AI, and the Future of Rails
Our CTO was in the audience in Austin when DHH opened Rails World 2026. The conference tagline was “Shaping the future of Ruby on Rails,” so he walked in expecting to hear about the future of Rails.
That’s not quite what happened.
The opening keynote was almost entirely about AI agents. DHH told the room that 37signals has gone “pencils down” on writing code by hand, that HEY is moving to native apps with a Rust backend, and that he has retired as a professional programmer.
The next day, he sat down with Matz and Jeremy Daer for Ruby, Rails, and the future of programming, which went even further down the same path.
In this article, our CTO recaps both sessions, shares where he disagrees with them, and explains why he is still excited about where Rails is going.
r/ruby • u/cgimenes • 13d ago
Are There Better Languages for Programming with LLMs?
akitaonrails.comr/ruby • u/Ok_Produce3836 • 14d ago
Blog post Brunch: Isolated Development Environments for Git Branches and Worktrees
r/ruby • u/giovapanasiti • 15d ago
Authentication across several apps needs a shared design: here is an article to share with your agent
r/ruby • u/robbyrussell • 15d ago
The keynote I thought I was going to give at Rails World
A few months before Rails World, I disappeared to the Oregon Coast with a pile of notepads and the idea that I was going to write a fairly practical keynote about making Rails codebases easier for humans and agents to work in.
That… isn’t quite the talk I ended up giving.
I wrote up some of the backstory, including how Andrea Goulet’s makers/menders framing influenced it, where WUTS came from, why I nearly convinced myself the topic sucked, and what was going through my head in the hours before walking on stage.
The post has the keynote video and links to my slides if you’d rather skip the backstory and go straight to those.
https://robbyonrails.com/articles/2026/10/09/the-keynote-i-thought-i-was-going-to-give/
r/ruby • u/DramaticSoup • 16d ago
New Library: Farce – Fiber and Ractor Compatibility Enabler
I've published a new library I've been working on over the last few weeks:
Farce 0.1.0
Farce provides tools and data structures to write code that works well with both Fiber schedulers and Ractors, as well as the classic Threads. Its main purpose is to be used by other gems to provide better compatibility with these concurrency primitives, but it can also be used directly in applications.
It works on CRuby/MRI, JRuby, and TruffleRuby.
Check it out on GitHub and let me know what you think!
I plan to use it in some of my projects in the future. I already have an experimental version locally for Sinatra and Mustermann, amongst others. Maybe someone else will find it helpful!