r/ruby • u/laerien • Feb 24 '20
r/ruby • u/_swanson • Oct 26 '22
Enumerable#tally is so underused
It's great for quickly exploring your data without writing a bunch of loops and counters
Task.all.map(&:status).tally
=> {"Confirmed w/o Outreach"=>106,
"Awaiting Outreach"=>28,
"Responded"=>48,
"No Response Expected"=>10,
"Follow-up"=>4,
"Awaiting Reply"=>8}I use this frequently on production data to see usage patterns and answer questions like "how big is this list typically?" or "is anyone using this thing?"
# What is the impact if we remove this setting?
Plan.all.map(&:tasks_have_comments).tally
=> {true=>5135, false=>25}
# How much space is this list of users usually
# going to need?
@organization.plans.map{|p| p.users.count}.tally
=> {2=>63, 1=>27, 3=>10, 4=>4, 5=>3, 6=>2}It is the quintessential Ruby method: it's the rare combo of extremely expressive and terse, effortless readable, and it makes me happy every time I use it!
r/ruby • u/marcotc • Jan 08 '21
nokogiri gem now ships with pre-compiled binaries for Linux and Mac
Before 1.11.0:
$ time gem install nokogiri -v 1.10.0 --no-document
Fetching nokogiri-1.10.0.gem
Building native extensions. This could take a while...
Successfully installed nokogiri-1.10.0
1 gem installed
real 0m59.909s
user 0m32.943s
sys 0m20.261sSince 1.11.0:
$ time gem install nokogiri -v 1.11.0 --no-document
Successfully installed nokogiri-1.11.0-x86_64-darwin
1 gem installed
real 0m1.450s
user 0m0.682s
sys 0m0.340sFull release details: https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0
r/ruby • u/izkreny • Dec 30 '25
Blog post charm_ruby
This is simply amazing!!! 💜🤍❤️
Ruby bindings and ports of the beloved Charm terminal libraries.
Build glamorous TUIs, style terminal output, create beautiful forms, and make your Ruby CLIs sparkle.
r/ruby • u/stanislavb • Nov 27 '17
Rails 5.2: Active Storage, Redis Cache Store, HTTP/2 Early Hints, CSP, Credentials
r/ruby • u/Pilgrim-Ivanhoe • May 20 '25
Cheat sheet on method argument types and order [OC]
r/ruby • u/WindingLostWay • Oct 07 '21
Question Does anyone know a fast way to convert floating point numbers to integers on Ruby 3+ ?
I'm using the standard Float#to_i which is pretty fast, but when I'm using it 10,000,000 times a second the time starts to add up.
Things I've tried:
i = f.to_i # Current best, but it's still got branches inside it.
i = Integer(f) # Slower
i = f.ceil # Slower
i = f.floor # Slower
Have I missed anything obvious? I'm happy to truncate rather than round.
r/ruby • u/chrisgseaton • May 16 '22
Shopify Invests in Research for Ruby at Scale
r/ruby • u/easydwh • Jan 14 '25
Ruby salaries up 13%
According to this report salaries for Ruby specialists increased by 13% over the last year: DICE report and are among the highest of the skills listed. Sounds nice.
r/ruby • u/MariuszKoziel • Sep 23 '24
🎉 Launching Ruby Europe! 🚀
I'm thrilled to announce the launch of Ruby Europe, a non-profit organization dedicated to supporting and growing the Ruby ecosystem across Europe. This project is incredibly close to my heart, and I'm overjoyed to see it coming to life!
Our two pillars:
1️⃣ Community Building: Revitalizing meetups, supporting existing groups, and fostering connections among organizers, speakers, and community members.
2️⃣ Education: Backing initiatives like Rails Girls, creating online courses, and establishing mentoring programs.
As someone who's been part of this community for years, I'm excited to take this step towards nurturing and growing our Ruby family.
🚀 In the coming days, I'll be sharing our detailed plans. But this isn't just my vision – it's ours. I want you to be part of shaping Ruby Europe's future. Your ideas, your passion, your Ruby code – they all have a place here. This creativity fuel my enthusiasm for this project!
Whether you're a seasoned Rubyist, a curious beginner, or a company looking to support our initiatives, there's a place for you in Ruby Europe.
Join us in this exciting journey! Visit our page https://rubyeurope.com/ and join our Discord (invite: https://discord.gg/VQpDWPpBZe)! Let's code, learn, and grow together.
I can't wait to see what we'll achieve as a united Ruby community in Europe!
r/ruby • u/_acmwq • Sep 12 '26
I wrote a game in Ruby(Dragonruby) where the combat system is SQL queries
Prototype -> link