Defining Methods
7676
function defineMethods(sugarNamespace, methods, type, args, flags) {
  forEachProperty(methods, function(method, methodName) {
    var instanceMethod, staticMethod = method;
    if (args) {
      staticMethod = wrapMethodWithArguments(method);
    }
    if (flags) {
      staticMethod.flags = flags;
    }

    // A method may define its own custom implementation, so
    // make sure that's not the case before creating one.
    if (type & INSTANCE && !method.instance) {
      instanceMethod = wrapInstanceMethod(method, args);
      setProperty(staticMethod, 'instance', instanceMethod);
    }

    if (type & STATIC) {
      setProperty(staticMethod, 'static', true);
    }

    setMethod(sugarNamespace, methodName, staticMethod);

    if (sugarNamespace.active) {
      // If the namespace has been activated (.extend has been called),
      // then map this method as well.
      sugarNamespace.extend(methodName);
    }
  });
}
9261
function(method, args){
      _.each(this._elements, function(elem){
        if (_.isFunction(elem[method])){
          elem[method].apply(elem, args || []);
        }
      });
    }
1253726
function( methodStr ){
    var parts = methodStr.split('['),
        definition = {
            name: parts[0],
            args: []
        },
        args
    ;

    if( parts.length > 1 ){
        args = parts[1];

        if( args[ args.length - 1 ] == ']' )
            args = args.slice(0, args.length - 1);

        definition.args = args.split(/\s*,\s*/);
    }

    return definition;
}
706908
function controllerMethod (controller, method) {
  if (controller && controller[method]) {
    return controller[method]
  }

  // Handle hello-based Controller classes
  if (isClass(controller) && controller.action) {
    return controller.action(method)
  }

  return notImplemented
}
733998
function createMethod() {
    if( !isset( $this->method ))
      return;
    switch( $this->format ) {
      case 'xcal':
        return ' method="'.$this->method.'"'.$this->nl;
        break;
      default:
        return 'METHOD:'.$this->method.$this->nl;
        break;
    }
  }
365855
def define_record_methods record
      record.class_eval <<-RUBY, __FILE__, __LINE__ + 1
        def #{name};        tuple.fetch(:#{field}, nil)   end
        def #{name}= value; tuple.store(:#{field}, value) end
      RUBY
    end
362224
public void defineFunction(String prefix, String function, Method method)
            throws java.lang.NoSuchMethodException {

        if (prefix == null || function == null || method == null) {
            throw new NullPointerException(Util.message(
                    context, "elProcessor.defineFunctionNullParams"));
        }

        int modifiers = method.getModifiers();

        // Check for public method as well as being static
        if (!Modifier.isStatic(modifiers) || !Modifier.isPublic(modifiers)) {
            throw new NoSuchMethodException(Util.message(context,
                    "elProcessor.defineFunctionInvalidMethod", method.getName(),
                    method.getDeclaringClass().getName()));
        }

        manager.mapFunction(prefix, function, method);
    }
749659
def define_cmp_method
      keys = @keys
      define_method(:cmp?) do |comparator, other|
        keys.all? { |key| send(key).send(comparator, other.send(key)) }
      end
    end
325446
def method(self, method):
        
        if method is None:
            raise ValueError("Invalid value for `method`, must not be `None`")  # noqa: E501
        allowed_values = ["WEBHOOK", "EMAIL", "PAGERDUTY"]  # noqa: E501
        if method not in allowed_values:
            raise ValueError(
                "Invalid value for `method` ({0}), must be one of {1}"  # noqa: E501
                .format(method, allowed_values)
            )

        self._method = method
469899
function(cls,methods) {
    var keys = Object.keys(methods);
    var len = keys.length;
    for (var i = 0; i < len; i++) {
      var key = keys[i];
      cls.prototype[key] = lib.method.createMethod(methods[key]);
    }
    return cls;
  }
384077
private void classifyMethod(ExecutableElement method) {
    switch (method.getParameters().size()) {
      case 0:
        classifyMethodNoArgs(method);
        break;
      case 1:
        classifyMethodOneArg(method);
        break;
      default:
        errorReporter.reportError("Builder methods must have 0 or 1 parameters", method);
    }
  }
843470
function apply_methods(Class, methods, descriptor) {
           Object.keys(descriptor).forEach(function (method) {
               methods[method] = descriptor[method];

               if (typeof(descriptor[method]) !== "function") {
                   throw new TypeError(
                       "extend: Method `" + method + "` is not a function"
                   );
               }

               Object.defineProperty(Class.prototype, method, {
                   "configurable" : true,
                   "value" : descriptor[method]
               });
           });
       }
904287
def method_missing(method, *args)
      super unless args.empty?
      super unless methods.include?(method)
      @exif.send method if defined?(@exif) && @exif
    end
1022261
def define_writer_method(attribute, method_name, visibility)
      define_method(method_name) { |value| attribute.set(self, value) }
      send(visibility, method_name)
    end
819521
private void writeMethod(Definition def, Writer out, int indent) throws IOException
   {
      if (def.getMcfDefs().get(getNumOfMcf()).isDefineMethodInConnection())
      {
         if (def.getMcfDefs().get(getNumOfMcf()).getMethods().size() > 0)
         {
            for (MethodForConnection method : def.getMcfDefs().get(getNumOfMcf()).getMethods())
            {
               writeMethodSignature(out, indent, method);
               writeLeftCurlyBracket(out, indent);
               writeIndent(out, indent + 1);

               if (!method.getReturnType().equals("void"))
               {
                  out.write("return ");
               }
               out.write("mc." + method.getMethodName() + "(");
               int paramSize = method.getParams().size();
               for (int i = 0; i < paramSize; i++)
               {
                  MethodParam param = method.getParams().get(i);
                  out.write(param.getName());
                  if (i + 1 < paramSize)
                     out.write(", ");
               }
               out.write(");");

               writeRightCurlyBracket(out, indent);
               writeEol(out);
            }
         }
      }
      else
      {
         writeSimpleMethodSignature(out, indent, " * Call me", "public void callMe()");
         writeLeftCurlyBracket(out, indent);
         writeWithIndent(out, indent + 1, "if (mc != null)\n");
         writeWithIndent(out, indent + 2, "mc.callMe();");
         writeRightCurlyBracket(out, indent);
      }

      writeEol(out);
      writeSimpleMethodSignature(out, indent, " * Close", "public void close()");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "if (mc != null)\n");
      writeLeftCurlyBracket(out, indent + 1);
      writeWithIndent(out, indent + 2, "mc.closeHandle(this);\n");
      writeIndent(out, indent + 2);
      out.write("mc = null;");
      writeRightCurlyBracket(out, indent + 1);
      writeRightCurlyBracket(out, indent);

      writeEol(out);
      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Set ManagedConnection\n");
      writeWithIndent(out, indent, " */\n");
      writeWithIndent(out, indent,
            "void setManagedConnection(" + def.getMcfDefs().get(getNumOfMcf()).getMcClass() + " mc)");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "this.mc = mc;");
      writeRightCurlyBracket(out, indent);
   }
1283404
@Override
    public void setMethod(String method) throws UnsupportedMethodException {
        MethodValues val = MethodValues.match(method, 0, method.length());
        if (null == val) {
            throw new UnsupportedMethodException("Illegal method " + method);
        }
        setMethod(val);
    }
965645
function(object, methods) {
        _.each(methods, function(method, name) {
            if (!_.isFunction(method)) {
                throw new Error('Method "' + name + '" must be a function!');
            }
            object[name] = method
        });
    }