Closed dekz closed 11 years ago
Did you try adding :: to all the classes to make sure you're getting to the top scope:
module ::Sprinkle
module Actors
class Test < Dummy
end
end
end
That seems to fix it, cheers Josh. It also works fine when required.
The scope of everything is different when Sprinkle is reading the file itself... so if you truly want the top-level class you have to make sure you add ::... otherwise you're just trying to access Sprinkle inside of another smaller scope - where no Sprinkle exists.
It doesn't seem to be possible to monkey patch or declare new classes inline to the sprinkle script.
Here is a gist with a reproducible file.
A work around for me is to use a script which programatically executes Sprinkle, similar to the way
./bin/sprinkle
does:What are your thoughts on this situation? Is there any other way to do this?