# ============================= # Spell: Lazy Instance Variable # ============================= # Wait until the first access to initialize an instance variable. class C def attribute @attribute = @attribute || "some value" end end obj = C.new obj.attribute # => "some value" # For more information: http://www.pragprog.com/titles/ppmetr/metaprogramming-ruby