On May 8, 2006, at 1:38 PM, Pat Maddox wrote:

> I'm writing a small app to do poker simulations.  I read a lot of
> blogs in which the author shows off his cool DSL.  I decided I want to
> be able to specify a poker hand in my app like
>
> hand "my_hand" do
>  players 10
>  chips     1000
> end
>
> my_hand.foo
>
> How can I do something like that?

class Hand
   ...
end

def hand( ..., &init )
   Hand.new( ... ).instance_eval(&init)
end

I really think you'll be happy in the long run though if you drop the  
instance_eval() and pass the hand into the block instead.

James Edward Gray II