method

slice

Importance_1
v2_5_5 - Show latest stable - 0 notes - Class: Hash
slice(*args) public

Returns a hash containing only the given keys and their values.

h = { a: 100, b: 200, c: 300 }
h.slice(:a)           #=> {:a=>100}
h.slice(:b, :c, :d)   #=> {:b=>200, :c=>300}
Show source
Register or log in to add new notes.