Le 01 septembre ? 17:43, Peter Hickman a ?crit :

> data = Array.new
> data << {"name" => "Admiral Ackbar"}
> data << {"name" => "Bail Organa"}

C'mon, where's the fun in that ?  :)

>> require "ostruct"
=> true
>> a = []
=> []
>> a << OpenStruct.new(:name => "Admiral Ackbar", :age => 30)
=> [#<OpenStruct name="Admiral Ackbar", age=30>]
>> a << OpenStruct.new(:name => "Bail Organa", :age => 65)
=> [#<OpenStruct name="Admiral Ackbar", age=30>, #<OpenStruct name="Bail Organa", age=65>]
>> a[0].name
=> "Admiral Ackbar"
>> a[1].age
=> 65
>> a.find { |e| e.age > 50 }
=> #<OpenStruct name="Bail Organa", age=65>

Fred
-- 
The key to my survival    Was never in much doubt   The question was how
I could keep sane      Trying to find the way out Things were never easy
for me    Peace of mind was hard to find    And I needed a place where I
could hide    Somewhere I could call mine      (Genesis, No Son of Mine)