From: FrihD Date: 2009-01-11T05:29:54+09:00 Subject: Re: What is meant by << operator ??? Hello, Muhammad mohsin ali Ma wrote: > What is meant by << operator? It is not an operator, but actually is the method "<<". So it depends on the object that receives this method. > def add_product(product) > current_item = @items.find {|item| item.product == product} > if current_item > current_item.increment_quantity > else > current_item = CartItem.new(product) > @items << current_item > end > current_item > end Consequently given that @items certainly is an Array, it appends current_item to @items which seems quite intuitive. --Lucas