title: ruby object array... or hash
body: <p>I have an object now:</p>
  
  <pre><code>class Items
    attr_accessor :item_id, :name, :description, :rating
  
    def initialize(options = {})
        options.each {
          |k,v|
          self.send( "#{k.to_s}=".intern, v)
        }
    end
  
  end
  </code></pre>
  
  <p>I have it being assigned as individual objects into an array...</p>
  
  <pre><code>@result = []
  
  some loop&gt;&gt;
     @result &lt;&lt; Items.new(options[:name] =&gt; 'name', options[:description] =&gt; 'blah')
  end loop&gt;&gt;
  </code></pre>
  
  <p>But instead of assigning my singular object to an array... how could I make the object itself a collection?</p>
  
  <p>Basically want to have the object in such a way so that I can define methods such as</p>
  
  <pre><code>def self.names
     @items.each do |item|
        item.name
     end
  end
  </code></pre>
  
  <p>I hope that makes sense, possibly I am overlooking some grand scheme that would make my life infinitely easier in 2 lines.</p>