title: Ruby: undefined method error
body: <p>I have this code that I have written in Ruby, but when trying to test my file in irb I receive a: <code>NoMethodError: undefined method 'find_displacement' for SymbolTable:Class</code>. What am I doing wrong here?</p>
  
  <pre><code>class SymbolTable
    include Singleton
  
    @@MAX_SYMBOLS  = 500
    @@DISPLACEMENT = SymbolTable.find_displacement()   ##error here
    @@TABLE_SIZE   = @@MAX_SYMBOLS + (@@MAX_SYMBOLS * 0.1) + @@DISPLACEMENT
  
    def initialize()
      "Constructs a single instance of a SymbolTable to be used by the compiler"
        @sym_table = Array.new(@@TABLE_SIZE)
    end
  
    def add(element, index)
      "Inserts an element (identifier) into the SymbolTable"
      @sym_table[index] = element if element.is_a? SymbolTableEntry
    end
  
    def SymbolTable.find_displacement()
      n = 1
      k = @@MAX_SYMBOLS
      while not (k + n).odd? do
        n += 2
      end
  
      return k + n
    end
  
    def to_s
      "Prints a list of all elements currently in the SymbolTable"
      pp @sym_table
    end
  end
  </code></pre>