Auto-curry a method

 @param [Symbol] name The name of a method

 @api private
558902
def auto_curry(name, &block)
      arity = instance_method(name).arity

      return unless public_instance_methods.include?(name) && arity != 0

      mod = Module.new

      mod.module_eval do
        define_method(name) do |*args, &mblock|
          response =
            if arity < 0 || arity == args.size
              super(*args, &mblock)
            else
              self.class.curried.new(self, view: name, curry_args: args, arity: arity)
            end

          if block
            response.instance_exec(&block)
          else
            response
          end
        end
      end

      auto_curried_methods << name

      prepend(mod)
    end
126034
def auto(name):
    '''
    
    '''
    cmd = [_get_cmd(), '--auto', name]
    out = __salt__['cmd.run_all'](cmd, python_shell=False)
    if out['retcode'] > 0:
        return out['stderr']
    return out['stdout']
201357
function( name, method ) {
			var m = this.settings.messages[name];
			return m && (m.constructor === String ? m : m[method]);
		}
677761
def method_missing(name, *args, &block)
      return meta[name.to_s] if meta.key?(name.to_s)
      super
    end
953648
def curry(*args)
      if curry_args.empty? && args.first.is_a?(Graph::InputEvaluator)
        Lazy[self].new(self, *args)
      else
        self.class.build(relation, { **options, curry_args: args })
      end
    end
780726
function(name, fn) {
    // Init options.
    var opts = {
      name: name,
      methods: {}
    };
    _.each(methodNames, function(methodName) {
      opts.methods[methodName] = function() {
        throw new Error('Method not implemented : ' + methodName);
      };
    });
    // Give options to callback function for decoration.
    fn(opts);
    // Return options.
    return opts;
  }
1261395
def callback(*names)
      names.each do |name|
        self.class_eval do
          define_method name, ->(*args, &block) do
            @callbacks ||= {}
            if block
              @callbacks[name] = block
            elsif @callbacks[name]
              @callbacks[name].call(*args)
            end
          end
        end
      end
    end
1100467
function (reqContext, name, args) {
    return BPromise.resolve()
        .bind(this)
        .then(function () {
            var method = this._methods[name];
            if (!method) {
                throw new MWError(404, "Method not found");
            }
            var context = R.merge(method.context, reqContext);
            return method.fn.apply(context, args);
        });
}
442748
function(name, protocols, requiredInstanceMethodDefs, requiredClassMethodDefs)
{
    this.name = name;
    this.protocols = protocols;
    if (requiredInstanceMethodDefs)
        this.requiredInstanceMethods = requiredInstanceMethodDefs;
    if (requiredClassMethodDefs)
        this.requiredClassMethods = requiredClassMethodDefs;
}
499256
def method_missing(method, *args, &block)
      name = method.to_s
      if respond_to_missing? name
        @bases[name]
      else
        super(method, *args, &block)
      end
    end
1095598
def method_missing(m, *args, &block)
      if block = ChefSpec.matchers[resource_name(m.to_sym)]
        instance_exec(args.first, &block)
      else
        super
      end
    end
258639
def stream_by_method_name(name):
    
    if name == u'local':
        name = u'parent'
    module = mitogen.core.import_module(u'mitogen.' + name)
    return module.Stream
1073824
function curry(fn, obj) {
  // create a local copy of the function. don't apply anything yet
  // optionally bind an object to the `this` of the function.
  var newFunction = _.bind(fn, (obj || null));

  // curried functions always take one argument
  return function () {
    // create another copy of the function with the arguments applied
    var me = _.partial(newFunction, arguments);

    // take advantage of the fact that bind changes the method signature:
    // if we have no arguments left, run the method
    if (!me.length) return me();

    // otherwise, curry again and return that.
    return curry(me);
  };
}
179104
def respond_to?(method_name, include_private=false)
      camelized_name = camelize(method_name.to_s)

      if key?(method_name) ||
          key?(camelized_name) ||
            method_name.to_s.slice(/[=?!_]\Z/)
        return true
      end

      super
    end
456525
def method_missing(name, *arguments)
      value = arguments[0]
      name = name.to_s
      if name[-1, 1] == '='
        key = name[/(.+)\s?=/, 1]
        @data[key.to_sym] = value unless instance_variables.include? "@#{key}".to_sym
      else
        @data[name.to_sym]
      end
    end
123821
def defn(name, fn = nil, &block)
      if fn
        define_method(name) { fn }
      else
        puts "Lambda rigamarole could be just { block }"
        define_method(name) { lambda(&block) }  # Todo: why is this lambda rigamarole required?
      end
      module_function name if respond_to?(:module_function, true) 
    end
855917
def method_missing(name, *args, &block)
      return @info[name.to_s] if @info.key? name.to_s
      return @info[name] if @info.key? name
      super.method_missing name
    end