Project

General

Profile

Actions

Feature #12523

open

`Object#values_at`

Added by sawa (Tsuyoshi Sawada) almost 5 years ago. Updated over 1 year ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:76161]

Description

It might be convenient to have a method that returns multiple attributes of an object.

class A
  attr_accessors :foo, :bar, :baz

  def initialize foo, bar, baz; @foo, @bar, @baz = foo, bar, baz end
end

a = A.new("a", "b", "c")
a.values_at(:baz, :foo) # => ["c", "a"]
Actions

Also available in: Atom PDF