syntactic sugar - Ruby: Shorthand for a[1] || a[3] || a[6] ...? -


I have a regular expression that gives more than one variable within a match. I am interested in the first non-redundant variable in the subset of the index inside the match, so I

  result = a [1] || A [3] || A [6] || ...  

I would like to store the relevant index with a regular expression in a configuration file. What does not mean the best short story signage?

Use values_at to get an array in which the specified indices only Elements include then find | | | | X} to get the first element which is not zero or false.

  results = a.values_at (* index) .find {| X | X}  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -