method

slice

Importance_1
v7.1.3.2 - Show latest stable - 0 notes - Class: Model
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" }
Show source
Register or log in to add new notes.