[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-core
Subject: [ruby-core:76166] [Ruby trunk Feature#12523] `Object#values_at`
From: shyouhei () ruby-lang ! org
Date: 2016-06-28 1:52:15
Message-ID: redmine.journal-59374.20160628015214.13ae5c7b27894669 () ruby-lang ! org
[Download RAW message or body]
Issue #12523 has been updated by Shyouhei Urabe.
I'm not that strongly against it, but wonder if it has actual usage where it is \
convenient. Do you have any use cases?
----------------------------------------
Feature #12523: `Object#values_at`
https://bugs.ruby-lang.org/issues/12523#change-59374
* 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>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic