code: public Object newInstance(String resource) {
          try {
              String name = resource.startsWith("/") ? resource : "/" + resource;
              File file = new File(this.getClass().getResource(name).toURI());
              return newInstance(classLoader.parseClass(new GroovyCodeSource(file), true));
          } catch (Exception e) {
              throw new GroovyClassInstantiationFailed(classLoader, resource, e);
          }
      }
docs: Creates an object instance from the Groovy resource
  
  @param resource the Groovy resource to parse
  @return An Object instance