On Oct 10, 2006, at 5:18 PM, Dipesh Batheja wrote:

> I am trying to create a class level attribute which can read and  
> write.
> I am doing something like this:
>
> def self.selected_client
>  -- my code --
> end
>
> def self.selected_client=(value)
> -- my code --
> end
>
> but its seems that the Ruby interpreter is not liking this. Can  
> someone
> tell me how to create class level attributes that can read and write.

<code>
#! /usr/bin/env ruby -w

class A
    class << self
       attr_accessor :foo
    end
end

A.foo = 'bar'
A.foo # => "bar"
</code>

Regards, Morton