Question: My googlefu sucks and was unable to find information on this.

Basically I want to have a instance variable that is visible only within the scope of a class/module but is also immutable.

I am new to Ruby and apologize if this question doesn't make much sense.

Answer: 
```
class MyClass
  def initialize
    class << self
      FOO=1
    end
  end
  def foo
    class << self
      FOO
    end
  end
end

```

Naturally, you'll want to use the method `foo` wherever possible to read the value.

A simpler equivalent would be 

```
class MyClass
  def initialize
    def foo; 1; end
  end
end

```
I wrote a gem for this case.
<http://rubygems.org/gems/instancevalue>

(The approaching as Ken's one.)