Ruby's Switch Statement Is More Flexible Than You Thought

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • ruby

    The Ruby Programming Language

  • > there's not compiled machine code that does a jump

    It's more of an implementation detail, but the Ruby VM actually does a jump if all the cases are "keyable"(typically integers, strings, symbols, etc). It does a hash lookup and jump to the returning address.

    https://github.com/ruby/ruby/blob/92466e440d459cd21e89f8bfbe...

  • rubychanges

    Comprehensive changelog of Ruby Programming Language

  • May I recommend to anyone facing similar issues and who may have at least some agency in dealing with the problem (can't assume you do, so forgive me in that case) the incredible work of Victor Shepelev with Ruby References: https://rubyreferences.github.io/rubychanges/evolution.html

    The site presents evolutions of Ruby since version 2.0 in an editorialized and well-written categorized release journal called "Ruby Evolution": https://rubyreferences.github.io/rubychanges/evolution.html

    There's also individual version releases annotated as well, for example for the recent Ruby 3.2: https://rubyreferences.github.io/rubychanges/3.2.html

    Note that these are not copies of the NEWS.md typically released when minor and major versions of Ruby come out. Victor specifically spent time to write more descriptive notes of what each notable change occurred over time. It's an incredible resource and we're extremely lucky to have him in our community.

    There's even a changelog for this meta-changelog, which makes my little Keep a Changelog heart sing, so you can see evolutions of this site over time as well: https://rubyreferences.github.io/rubychanges/

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • toe_tag

    Utilities for categorizing and specifying exceptions.

  • Here's the library: https://github.com/mboeh/toe_tag

    It's a decade old and less than 100 lines so it might be more useful as an example than a gem. The last time I needed to do something like this I just rewrote the parts I needed. The ecosystem is just generally better about exceptions than it used to be, too.

  • DistorteD

    Ruby multimedia toolkit with deep Jekyll integration 🧪

  • Just a style thing. I find it less visually overwhelming when every statement that contributes a true/false is visually contiguous. You can see it in context here if curious: https://github.com/okeeblow/DistorteD/blob/NEW%E2%80%85SENSA...

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts