This will sound strange, but I would like to do something like this:
case cool_hash when cool_hash[:target] == "bullseye" then do_something_awesome when cool_hash[:target] == "2 pointer" then do_something_less_awesome when cool_hash[:crazy_option] == true then unleash_the_crazy_stuff else raise "Hell" end
Ideally, I would not even need to refer to this again, as this statement is about the case. If I wanted to use only one option, I would have "case cool_hash [: that_option]", but I would like to use any number of options. Also, I know that case statements in Ruby evaluate only the first true conditional block, is there a way to override this to evaluate every block that is true if there is no break?
source share