Question

Here is the scenario:

case code
  when 'www', '', nil
    false
  when 'code1', 'code2'... 'code_n' # The array STORE_CODES contains all the codes 
    true
  else
    false
end

How can I use STORE_CODES directly after when instead of 'code1', 'code2'... 'code_n'

Was it helpful?

Solution

just use:

when *STORE_CODES

instead of :

when 'code1', 'code2'... 'code_n'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top