Christoph Jasinski wrote:
> I've seen something which Shoulda is capable of: (that's a kind of a 
> DSL,
> right?)
> 
> class RubyMagic < Test::.....
> .
> .
> .
>   should "be a minor if younger than 18" do
>     .
>     this and that
>     .
>   end
> .
> .
> .
> end
> 
> How do you write things like this. I wanted to let the user say 
> something
> like this and then proceed his/her request. Is it possible?Is it not 
> that
> difficult?

I'd suggest that a good starting point is to install shoulda and look at 
its source code.

Note that

   should "be a minor" do
     stuff
   end

is just a regular method call with a block. Try this:

def should(*args)
  puts "Got args: #{args.inspect}"
  if block_given?
    puts "Got a block"
    yield
  end
end

should "be a minor" do
  puts "I am here"
end
-- 
Posted via http://www.ruby-forum.com/.