On Dec 29, 11:55=A0am, Robert Klemme <shortcut... / googlemail.com> wrote:

> Then your block needs to contain a class definition. =A0You can use the
> block only for _one_ thing - either class / module def or code you
> want to execute. =A0Granted, you can have code executed in a class
> definition as well but the definition becomes only usable *after* the
> definition has been executed in its entirety.

That's true. But the execution of the block is only for the definition
of things which get run later.

>=A0Maybe you haven't
> decided yet what you want the block for and that is causing your
> headaches.

The block is for defining unit tests. Eg.

  testcase SomeClass do
    testunit :somemethod =3D> "some concern" do
      ...
    end
  end

> > Haven't tested it yet, but that should allow #include to work no
> > problem. Unfortunately it means defining all my dsl methods at the
> > class level --not even sure the instance level would be of any use in
> > this case either, in which case the ._new can be dropped -- kind of
> > stupid, just to get #include to work. But what else can I do?
>
> > I almost feel like I'm having a mental block and there is actually an
> > easy way to do this.
>
> What stops you from doing the include outside?
>
> include Your::Module::Of::Choice
>
> TestCase.new Foo do
> =A0 x =3D ChoiceClass.new
> =A0 x.method_invocation(123)
> end

Yes, I am able to do that. But I want to avoid polluting the top
level.

You know what really gets me is that even though I get an
"uninitialized constant" error, there is no place I seem to be able to
define a #const_missing method to catch it.