Stefano Crocco
6/2/2009 12:43:00 PM
On Tuesday 02 June 2009, Markus Fischer wrote:
> |Hi,
> |
> |Stefano Crocco wrote:
> |> Simply create a constant which points to the module:
> |>
> |> FinallyMyClass = MyModule::HasSubmodile::AndAnotherOne::FinallyMyClass
> |>
> |> With this you can do:
> |>
> |> obj = FinallyMyClass.new
> |>
> |> I hope this helps
> |
> |I don't think so, as it does not make the current scope aware of
> |modules/namespace. Without prefix, I just can't access FinallyMyClass
> |like I would do it in java(-ish).
> |
> |Probably nothing which belongs into ruby/dynamically typed language.
> |
> |thanks,
> |- Markus
Sorry, I think I misunderstood your question. I thought you only wanted to use
a single class without prefix, but reading again your first mail, it seems
that you want everything under MyModule::HasSubmodile::AndAnotherOne to look
like it was in the main object (or in the module you're working in). Is this
correct? If so, you can try including the
MyModule::HasSubmodile::AndAnotherOne module inside your own, or in the
toplevel object, like this:
include MyModule::HasSubmodile::AndAnotherOne
This will give you access to constants and instance methods defined in
AndAnotherOne (but not to its class methods or to constants defined in
MyModule or HasSubmodule). I'm not completely sure this is exactly what you
want, but it's the best thing I can think of (I don't know java, so I don't
know what exactly you expect to be able to do with this).
Stefano