vendredi 4 novembre 2016

Dynamic condition in ruby on rails

I have the following condition:

if "FIX_STRING 0,0,DYNAMIC_STRING" == "FIX_STRING #{integer_from_0_to_5},#{integer_from_0_to_5},#{DYNAMIC_STRING}"
  true
else
  false
end

How to make it dynamically like this?

if "FIX_STRING 0,0,DYNAMIC_STRING" == "FIX_STRING #{/0|1|2|3|4|5/},#{/0|1|2|3|4|5/},#{/A|B|C|D/}"
  true
else
  false
end

Aucun commentaire:

Enregistrer un commentaire