Ruby supports pattern matching. For example
case value
in ["apple" | "pear" | "banana" => fruit]
puts fruit
else
puts "no match"
end
Is it a way to convert an array (ie ["apple", "pear", "banana"]
)
to the set of multiple values in the pattern matching above?