Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
class MetaCVar def self.map1 @@map1 ||= {} end foo = (map1['foo'] ||= {}) puts foo.inspect puts map1['foo'].inspect puts @@map1.inspect map1['foo']['bar'] = "baz" class << self def map2 @@map2 ||= {} end end foo = (map2['foo'] ||= {}) puts foo.inspect puts map2['foo'].inspect puts @@map2.inspect map2['foo']['bar'] = "baz" end ## MRI Output agardiner@Ads-MacBook:~/rubinius(master)$ ruby ~/test_meta_cvar.rb {} {} {"foo"=>{}} {} {} {"foo"=>{}} ## Rubinius Output agardiner@Ads-MacBook:~/rubinius(master)$ bin/rbx ~/test_meta_cvar.rb {} {} {"foo"=>{}} {} nil {} An exception has occurred: No method '[]=' on an instance of NilClass. (NoMethodError) Backtrace: Kernel(NilClass)#[]= (method_missing_cv) at kernel/core/kernel.rb:647 MetaCVar.__class_init__ (MetaCVar) at /Users/agardiner/test_meta_cvar.rb:22 Object#__script__ at /Users/agardiner/test_meta_cvar.rb:1 CompiledMethod#as_script at kernel/core/compiled_method.rb:379 Compile.single_load at kernel/core/compile.rb:252 Compile.load_from_extension at kernel/core/compile.rb:324 Object#__script__ at kernel/loader.rb:291
This paste will be private.
From the Design Piracy series on my blog: