Use Hash’s values_at
method:
from, to, name = hash.values_at(:from, :to, :name)
This will return nil
for any keys that don’t exist in the hash.
Use Hash’s values_at
method:
from, to, name = hash.values_at(:from, :to, :name)
This will return nil
for any keys that don’t exist in the hash.