Issue #12523 has been updated by Tsuyoshi Sawada.


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

~~~ruby
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"]
~~~


----------------------------------------
Feature #12523: `Object#values_at`
https://bugs.ruby-lang.org/issues/12523#change-59370

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
It might be convenient to have a method that returns multiple attributes of an object.

~~~ruby
class A
  attr_accessors :foo, :bar, :baz

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

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





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>