The #fetch utility acts in (roughly) the same way as Ruby's Hash#fetch function.
This addition should hopefully make constructors more rigorous and help to
prevent a few classes of errors.
This commit reframes the Utils module to be more self-contained, and now only
the Number prototype methods and the every/after/constantly methods are exposed
globally.
I'm unsure about whether these methods can be more scoped such that people can
turn them off if they want, but that's potentially something to look into in the
future.
This commit also updates most of the other source files in Cylon, requiring the
Utils module rather than assuming the methods are in the global namespace.
A similar batch of commits will need to be made for all other Cylon modules to
make sure they don't explode when they can't find #subclass or something like
that.
To make the previously-global methods available, both in submodules and for
people looking for them, all the utility functions are exported in Cylon.Utils.
This commit moves Utils to live in the global Cylon namespace, so they can be
accessed in test suites. This is necessary because Mocha, when setting up for
tests, will override our #after method, making TDR not work if any robots
contain a #after call in their work block.
To fix this, in test setup you can call global.Cylon.Utils.bootstrap();
which will re-setup our globals.