Is there a way to access the variable being tossed through the
case/when structure?
You mean object not variable. But no.
end
But it would save a line to be able to access the actual variable being
used in the case/when structure.
If you want to save a line you can do
case x = object.size.to_s
…
Btw, why do you convert to string and then use regexps on the name? Do
you want to check for numbers with all the same digits? You can do that
with this RX: /^(\d)\1*$/
Kind regards
robert
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.