Twiddle-wakka (Yes, that's a real thing)

github logo ・1 min read

You may or may not know that Ruby has a pessimistic operator:

~>

It's actually a pretty cool little thing used in Gemfiles to specify a version range.

gem 'rails', '~> 5.2.1'
gem 'devise', '~> 4.6'
gem 'puma', '~> 3'

is the same as specifying:

gem 'rails', '>= 5.2.1', '< 5.3.0'
gem 'devise', '>= 4.6.0', '< 5.0'
gem 'puma', '>= 3.0', '< 4.0'

But what is even better about it is it's name. ~> is called a twiddle-wakka

I hope you laughed as much at this as I did.

Happy Friday!

twitter logo DISCUSS (2)
markdown guide
 

This ranks right up there IMO with Python calling it's new := operator the 'walrus operator'.

 
Classic DEV Post from Mar 15

What was your win this week?

Got to all your meetings on time? Started a new project? Fixed a tricky bug?

Drew Bragg profile image
Full Stack Dev | Single Dad | Board Game Geek | Rucker

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️