I want do do something like this

class MyClass

 def default
  self.default
 end

 def self.default
  return @@default if @@default
  self.default = 'this'
 end

 def self.default=(value)
   @@default = value
 end
end

a = MyClass.new
=> nil
a.default
=> "this"

But, this does not work.  What is the idiom to get this to happen?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to