Converts block into API::Callback object that can be used as API callback argument
967363
def callback(params, returns, &block)
      Win32::API::Callback.new(params, returns, &block)
    end
255275
def method_missing(meth, *args, &block)
      db.to_hash(:key, :value).send(meth, *args, &block)
    end
24882
def as_api_response(api_template, options = {})
      collect do |item|
        if item.respond_to?(:as_api_response)
          item.as_api_response(api_template, options)
        else
          item
        end
      end
    end
989270
function API(method, url, data, callback) {
    if (typeof callback === 'undefined') {
        callback  = data;
        data  = {};
    }

    url             = this.prepareUrl(url);
    this.callback   = callback || noop;
    this.data       = data;

    this.options          = extend({}, requestOptions);
    this.options.encoding = this.options.encoding || 'utf-8';

    // these particular set of options should be immutable
    this.options.method         = method;
    this.options.uri            = url;
    this.options.followRedirect = false;

    this[method.toLowerCase()]();

    return this;
}
846966
function(blocks) {
  var blockarr = blocks;
  if (!(blockarr instanceof Array)) {
    blockarr = [blockarr];
  }
  return {format: 'section', blocks: blockarr};
}
280481
def _expand_block(cls, block):
        
        cls._parse_header(BlockHeader, block)
        if 'batches' in block:
            block['batches'] = [cls._expand_batch(b) for b in block['batches']]
        return block
353468
def method_missing(name, *args, &block)
      if args.empty? && !block_given? && @arg_names.include?(name)
        @args[name]
      else
        super
      end
    end
171155
function(block){
    var ast = [];
    if (this.pp) {
      ast.push(t.expressionStatement(t.callExpression(
        t.memberExpression(t.identifier('pug_indent'), t.identifier('push')),
        [t.stringLiteral(Array(this.indents + 1).join(this.pp))]
      )))
    }
    ast.push(
      t.expressionStatement(t.logicalExpression('&&',
        t.identifier('block'),
        this.wrapCallExpression(t.callExpression(t.identifier('block'), []))
      ))
    );
    if (this.pp) {
      ast.push(t.expressionStatement(t.callExpression(
        t.memberExpression(t.identifier('pug_indent'), t.identifier('pop')),
        []
      )))
    }
    return ast;
  }
60182
def __mock_dispatch_call context, disp, actual_args, actual_block, &_yield
      args = if disp.peek_args
               __mock_block_call(context, disp.peek_args,
                                 actual_args, actual_block, true)
             else
               actual_args
             end

      ret = if disp.returns
              __mock_block_call(context, disp.returns,
                                args, actual_block, true)
            elsif disp.original_method # proxies for singleton methods
              context.__send__(disp.original_method, *args, &actual_block)
            else # proxies for instance methods
              # need the original context for calling `super`
              # ruby: can't pass a block to yield, so we name it _yield
              _yield.call(args, &actual_block)
            end

      if disp.peek_return
        __mock_block_call(context, disp.peek_return, ret, EmptyBlock, false)
      else
        ret
      end
    end
1246942
def define_callback(name)
      class_eval <<RUBY, __FILE__, __LINE__ + 1
def on_#{name}(&block)
  @_sass_callbacks = {} unless defined? @_sass_callbacks
  (@_sass_callbacks[#{name.inspect}] ||= []) << block
end

def run_#{name}(*args)
  return unless defined? @_sass_callbacks
  return unless @_sass_callbacks[#{name.inspect}]
  @_sass_callbacks[#{name.inspect}].each {|c| c[*args]}
end
private :run_#{name}
RUBY
    end
623710
def error_block!(key, *block_params)
      base = settings
      while base.respond_to?(:errors)
        next base = base.superclass unless args_array = base.errors[key]
        args_array.reverse_each do |args|
          first = args == args_array.first
          args += [block_params]
          resp = process_route(*args)
          return resp unless resp.nil? && !first
        end
      end
      return false unless key.respond_to? :superclass and key.superclass < Exception
      error_block!(key.superclass, *block_params)
    end
294688
def with(&block)
      raise ArgumentError.new("Must pass a block") unless block_given?
      case block.arity
        when 1
          yield self
        when 0
          instance_methods_eval(&block)
        else
          raise "block arity must be 0 or 1"
      end
    end
402436
function( name, match, block ) {
		var self = this, result = { passed: false, extra: 'Block did not throw error' };

		// Variable arguments
		if ( block === undefined && munit.isFunction( match ) ) {
			block = match;
			match = undefined;
		}

		// Fail quick if block isn't a function
		if ( ! munit.isFunction( block ) ) {
			throw new Error( "Block passed to assert.throws is not a function: '" + block + "'" );
		}

		// test for throwing
		try {
			block();
		}
		catch ( e ) {
			result = self._errorMatch( e, match );
		}

		return self.ok( name, result.passed, self.throws, result.extra );
	}
934320
def method_missing(name, *args, &block)
      return attr(name[0..-2], args[0]) if args.size == 1 and name[-1] == '='
    end
865099
function _getBlock (config, type, multi) {
  const options = {
    uri: _buildUrl(config, type, multi)
  }

  if (config.headers) {
    options['headers'] = config.headers
  }
  return request.get(options).then(result => { return { blockName: type, result: result } })
}
434204
def define(&block)
      if block && block.arity > 0
        block.call @ns
      elsif block
        @ns.instance_eval(&block)
      end
      @ns
    end
1272164
def call(*args, &block)
      self.result = defined?(super) ? super(*args, &block) : to_proc.call(*args, &block)
    end