module Foot @size = 10 class << self attr_accessor :size end end Foot.size = 8
In my opinion, class/module-level attributes are useful enough that it ought to be provided by the language itself.
Edit: Come to think of it, most people, that I have seen, use globals to set constants. That currently has perfectly good syntax:
module Foot SIZE = 10 end print Foot::SIZE
module Foo class << self attr_accessor :bar end end Foo.bar = "baz"
In my opinion, class/module-level attributes are useful enough that it ought to be provided by the language itself.
Edit: Come to think of it, most people, that I have seen, use globals to set constants. That currently has perfectly good syntax: