Project

General

Profile

Feature #12523

Updated by sawa (Tsuyoshi Sawada) almost 5 years 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