From: Matthew Moss Date: 2008-09-20T23:44:20+09:00 Subject: Re: One-Liners Mashup (#177 again) > I'm no metaprogramming wizard... I keep trying variations until it > works.  :D  This seems to work. > > class YourClass >   def []=(f, v) >     class << self; self end.instance_eval{ attr_accessor f }; > instance_eval "@#{f}=v" >   end > end Oops... I forgot to put up a new one-liner question! (Don't forget you guys!!!) Here's something simple: define method roll(n, s) to roll a s-sided die n times and display a bar graph of the results. So roll(20, 4) might look like this: 1|##### 2|##### 3|###### 4|####