hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Monday

2005.04.25

Because I Haven't Posted a Picture of Just Goblets In a Great While #

by why in cult

A striking configuration of chalices nesting in their very own drakkar. In this way, should our dynasty fall, should son-shi be toppled, should the sky punchers be comprised and shame be cast upon our houses—at least these emblems will be dispatched safely, bearing the last remnant of our brotherhood, still wet from the saliva we once so mutually shared.

Found here (and realized at $575 American), among other red-stained items which appear to have once been pure and porcelain but now irreparably smudged by the mouths of those overboard on tropical punch.

Attr for Classes #

by why in inspect

Someone on Ruby-Talk was recently asking about an attr_accessor workalike for Classes. While writing my metaclasses article, I spent a bit of time poking around the goodies in Rails’ active_support directory and came across class_attribute_accessors.rb, which does the business.

After loading the class, use cattr_reader, cattr_writer, and cattr_accessor as you would the instance equivalents.

 class MailTruck
   cattr_accessor :trucks, :customers
 end
 MailTruck.trucks = [:UPS_TRUCK_9189, :UPS_TRUCK_9192]

You can also wield mattr_* methods as well.

Undead.rb #

by why in inspect

While browsing the bigbold collection of Ruby snips, a very interesting battle pitting Ruby’s internal means of self-termination against the collar-snatching wait-hey-you-get-back-here of ensure.

 begin
   Thread.current.kill
   exit(1)
   #`kill -9 #{$$}` # this will successfully kill you
   puts "after kill" 
 ensure
   puts "HA HA!" 
 end 

Courtesy of Mathieu Jobin (~somekool.)