title: Clarification on the Ruby << Operator
body: <p>I am quite new to Ruby and am wondering about the <code>&lt;&lt;</code> operator. When I googled this operator, it says that it is a Binary Left Shift Operator given this example:</p>
  
  <blockquote>
    <p><code>a &lt;&lt; 2</code> will give <code>15</code> which is <code>1111 0000</code></p>
  </blockquote>
  
  <p>however, it does not seem to be a "Binary Left Shift Operator" in this code:</p>
  
  <pre><code>class TextCompressor
    attr_reader :unique, :index
  
    def initialize(text)
      @unique = []
      @index = []
  
      add_text(text)
    end
  
    def add_text(text)
      words = text.split
      words.each { |word| do add_word(word) }
    end
  
    def add_word(word)
      i = unique_index_of(word) || add_unique_word(word)
      @index &lt;&lt; i
    end
  
    def unique_index_of(word)
      @unique.index(word)
    end
  
    def add_unique_word
      @unique &lt;&lt; word
      unique.size - 1
    end
  end
  </code></pre>
  
  <p>and <a href="https://stackoverflow.com/questions/4135464/operator-in-ruby">this question</a> does not seem to apply in the code I have given. So with the code I have, how does the Ruby <code>&lt;&lt;</code> operator work?</p>