title: Make instance variable read-only in Ruby?
body: <p>Is there any way to protect an instance variable from being written to/modified in Ruby?</p>
  
  <p>Say I do this:</p>
  
  <pre><code>class Test
    def initialize(var)
     @var = var
    end
  
    def modify
     @var = "test" # This would raise an error, saying '@var' is just readable.
    end
  end
  </code></pre>
  
  <p>Is there any way to make instance variable to be read-only? If not, which kind of attribute am I looking for?</p>