Reputation: 147
Is there a better way to write the following method (if possible converting it into a single line?).
def create_array(opts)
array = []
opts.each{|key,value| array << value}
array
end
Upvotes: 1
Views: 66
Reputation: 4440
If opts
is hash
so try it:
def create_array(opts)
opts.values
end
Upvotes: 3