method

slice

slice
public

Returns a hash of the given methods with their names as keys and returned values as values.

person = Person.new(id: 1, name: "bob")
person.slice(:id, :name)
# => { "id" => 1, "name" => "bob" }