def compilation_snippet(args)
      method    = args.fetch(:method)
      arguments = args.fetch(:arguments)
      locals    = args.fetch(:locals)
      options   = args.fetch(:options)

      <<-JAVASCRIPT
        (function() {
          var engine   = #{ npm_package_require_snippet };
          var template = engine[#{ JSON.dump(method) }].apply(engine, #{ JSON.dump(arguments) });

          if (typeof template === 'function') {
            template = template(#{ JSON.dump(locals) });
          }

          if (typeof console === 'object' && console !== null && typeof console.log === 'function') {
            console.log(template);
          }

          return template;
        })()
      JAVASCRIPT
    end
def compilation_snippet(args)
      method    = args.fetch(:method)
      arguments = args.fetch(:arguments)
      locals    = args.fetch(:locals)
      options   = args.fetch(:options)

      <<-JAVASCRIPT
        (function() {
          var engine   = #{ npm_package_require_snippet };
          var template = engine[#{ JSON.dump(method) }].apply(engine, #{ JSON.dump(arguments) });

          if (typeof template === 'function') {
            template = template(#{ JSON.dump(locals) });
          }

          if (typeof console === 'object' && console !== null && typeof console.log === 'function') {
            console.log(template);
          }

          return template;
        })()
      JAVASCRIPT
    end
Generates the JavaScript code that is the bridge
 from the gem to the template engine compiler.

 The code responds for:
 - invoking compiler
 - rendering template function with given locals
 - returning the result

 @param :method [String]
   The name of engine method to call.
 @param :arguments [Array<Object>]
   The array of arguments to be passed to the method.
 @param :locals [Hash]
   The hash of template local variables to be used to render template.
 @param :options [Hash]
   The hash of options passed to {#compile}.
 @return [String]