Answers for "rails hash slice"

0

hash.slice ruby

h = { a: 100, b: 200, c: 300 }
h.slice(:a)           #=> {:a=>100}
h.slice(:b, :c, :d)   #=> {:b=>200, :c=>300}
Posted by: Guest on April-22-2021

Browse Popular Code Answers by Language