Project

General

Profile

Feature #12523

Updated by sawa (Tsuyoshi Sawada) 6 months ago

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, A.values_at(:baz, :foo) # => ["c", "a"] 
 ~~~ 

Back