### Returns * Instance of Cellar
516617
function Cellar(name, mongoose, schema, options) {
	// connect to mongodb if they pass credentials
	if(mongoose.constructor.name === 'Object') {
		var mongoUrl = 'mongodb://' + mongoose.user + ':' + mongoose.pass + '@' + mongoose.host + ':' + mongoose.port + '/' + mongoose.name;
		mongoose = _mongoose.connect(mongoUrl);
	}
	// create a schema instance if they pass the literal
	schema = schema instanceof mongoose.Schema ? schema : new mongoose.Schema(schema);

	options = options || {};
	//default maxAge is 1 day, -1 means no expiration
	var maxAge = (typeof options.maxAge === undefined ? 1 : options.maxAge);
	// initialize lastChecked as a long time ago
	var lastChecked = new Date(0);
	// add an `updated_at` field to track when the document was last touched
	schema.add({updated_at: {type: Date, required:true, "default": Date.now}});

	// instantiate the model
	var mongoose_model = mongoose.model(name, schema);

	// prune

	// Private
	// Remove expired documents from the collection

	// ### Arguments
	// None

	// ### Returns
	// None

	function prune() {
		//check if this database is meant to be pruned
		if(~maxAge) {
			var d = new Date();
			d.setDate(d.getDate() - maxAge);

			if(lastChecked < d) { // make sure we're not trying to prune more often than at least maxAge since the last time we did
				mongoose_model.remove()
					.where('updated_at').lt(d)
					.exec(function(error, numAffected) {
						lastChecked = new Date(); //update our lastChecked to reflect our touching the database
						if(error) {
							console.log("Error while removing docs from database", error);
						} else {
							if(options.verbose) {
								console.log("Removed "+numAffected+" old docs from the database.");
							}
						}
					});
			}
		}
	}

	// Cellar#store

	// Public
	// Create or update a document in the collection

	// ### Arguments
	// * `where` - Optional Object describing criteria by which to update the document (see http://www.mongodb.org/display/DOCS/Querying)
	// * `data` - Object of data to update or create the document
	// * `callback` - Function to be evaluated upon completion of the insert/update
	//		- Arguments
	//			1. Error
	//			2. Mongoose document created or updated

	// ### Returns
	// * Instance of Cellar

	this.store = function(where, data, callback) {
		if(arguments.length < 3) {
			callback = data;
			data = where;
			where = null;
		}

		if(where) {
			//update
			data.updated_at = Date.now();
			for(var p in where) {
				if(where.hasOwnProperty(p)) {
					if(typeof data[p] === 'undefined') {
						// add all the `where` properties to the replacement doc (where there are no conflicts) in case this document gets upserted
						data[p] = where[p];
					}
				}
			}
			mongoose_model.findOneAndUpdate(where, data, {upsert:true}, callback);
		} else {
			//insert
			var store = new mongoose_model(data);
			store.save(callback);
		}
		//prune the db
		prune();
		return this;
    };

    // Cellar#retrieve

	// Public
	// Find a document in the collection

	// ### Arguments
	// * `where` - Object of criteria by which to find the document (see http://www.mongodb.org/display/DOCS/Querying)
	// * `fields` - Optional Array of String field names to retrieve on the document
	// * `callback` - Function to be evaluated upon completion of the find operation
	//		- Arguments
	//			1. Error
	//			2. Mongoose document that matched the criteria or null if no document matched

	// ### Returns
	// * Instance of Cellar

    this.retrieve = function(where, fields, callback) {
		if(arguments.length < 3 || fields === undefined || fields === null) {
			fields = [];
		}
		var args = [where];
		if(fields.length) {
			args.push(fields.join(" "));
		}
		args.push(callback);
		mongoose_model.findOne.apply(mongoose_model, args);
		return this;
    };

    // Cellar#retrieve_field

	// Public
	// Find the contents of one field on a document in the collection

	// ### Arguments
	// * `where` - Object of criteria by which to find the document where the field is (see http://www.mongodb.org/display/DOCS/Querying)
	// * `field` - String name of field desired
	// * `callback` - Function to be evaluated after the find is completed
	//		- Arguments
	//			1. Error - will also return an error if looking for a field on a document which does not have the field
	//			2. Contents of `field` in a matching document, or null if no document matched

	// ### Returns
	// * Instance of Cellar

    this.retrieve_field = function(where, field, callback) {
		this.retrieve(where, [field], function(error, doc) {
			if(error || !doc) {
				callback(error);
				return;
			}
			if(!doc[field]) {
				callback(new Error(field+" does not exist in this document"));
				return;
			}
			callback(null, doc[field]);
		});
		return this;
    };

    return this;
}
620721
def [](key)
      if @my_vars.include?(key)
        @my_vars[key]
      else
        @coa_vars.each do |coa_vars|
          if coa_vars.include?(key)
            @my_vars[key] = deep_dup(coa_vars[key])
            return @my_vars[key]
          end
        end
        nil
      end
    end
1089748
def bench_factory():
    

    class TestSchema(BaseSchema):
        attr_1 = StringNode()
        attr_2 = IntegerNode()

        @property
        def attr_3(self):
            return 'FooBar'

        @staticmethod
        def prepare_attr_1(value):
            return 'Attr#{}'.format(value)

        @staticmethod
        def prepare_attr_2(value):
            return 'Attr#2{}'.format(value)

    return [TestSchema(**obj) for obj in object_loader()]
1334478
def locals
        @_locals ||= begin
          scope   = controller.instance_variable_get(:"@scope")
          results = ([scope] + resources).compact

          (options[:locals] || {}).tap do |hash|
            results.each do |object|
              hash[key_for(object)] = object
            end
          end
        end
      end
736481
def options
      Hash[*Vault::Configurable.keys.map do |key|
        [key, instance_variable_get(:"@#{key}")]
      end.flatten]
    end
473576
function() {
        var dest = gulp.dest('tmp/');
        dest.on('end', function() {
          grunt.log.ok('Created tmp/fn.js');
        });
        return gulp.src('test/fixtures/*.coffee')
          .pipe(coffee())
          .pipe(concat('fn.js'))
          .pipe(dest);
      }
1128542
def find_node(key)
      return nil if @root == nil
      node = @root.find_vertical(key)
      (node.nil? || node.value.nil? ? nil : node)
    end
1030576
def fetch(key, type, default = nil)
			if (real_hash.has_key?(key))
				value = real_hash[key]

				# if type is not an array, but value is, flatten it.
				if (type != Array && !type.kind_of?(Array) && value.kind_of?(Array))
					value = value[0]
				end

				real = type.from_user_input(value)
				if (real != nil)
					return real
				end
			end
			return default
		end
70026
def __yield
      return if (source = @_undies_source_stack.pop).nil?
      if source.file?
        instance_eval(source.data, source.source, 1)
      else
        instance_eval(&source.data)
      end
    end
313271
def to_ru!
      self.each_with_index do |x, row, col|
        if x.nil? || x.value.nil?
          self[row, col] = nil
        else
          self[row, col] = x.to_ru
        end
      end
    end
649564
function getParents (node, test, key, childrenKey, parentKey) {
  var i, v, p = node, path = [];
  while (p) {
    if (test(p)) {
      if (childrenKey) {
        for (i = 0; i < path.length; i++) {
          arrayKV(p, childrenKey, path[i], false, true);
        }
      }
      if (path[0] && parentKey) {
        path[0][parentKey] = p;
      }
      path.unshift(p);
    }
    p = p.parent;
  }
  for (i = 0; i < path.length; i++) {
    v = path[i];
    path[i] = key ? v[key] : v;
  }

  return path
}
345165
function getPseudoClass1() {
  const type = NodeType.PseudocType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  const content = [];

  // Skip `:`.
  pos++;

  content.push(getIdent());

  {
    const type = NodeType.ArgumentsType;
    const token = tokens[pos];
    const line = token.ln;
    const column = token.col;

    // Skip `(`.
    pos++;

    const selectorContent = [].concat(
      getSC(),
      getSelectorsGroup(),
      getSC()
    );

    const end = getLastPosition(selectorContent, line, column, 1);
    const args = newNode(type, selectorContent, line, column, end);
    content.push(args);

    // Skip `)`.
    pos++;
  }

  return newNode(type, content, line, column);
}
405302
def dzen
      return @@dzen unless @@dzen.nil?

      @@dzen = DZEN::Terminal.new if defined?(::TERMINAL) || !!ENV['TERMINAL']
      @@dzen = DZEN::Default.new unless @@dzen

      @@dzen
    end
1302617
def instance_read(attr)
      getter = :"#{name}_#{attr}"
      responds = instance.respond_to?(getter)
      cached = self.instance_variable_get("@_#{getter}")
      return cached if cached
      instance.send(getter) if responds || attr.to_s == "file_name"
    end
231827
def client
      return @client if @client

      @client = Chef::Client.new
      @client.ohai.data = Mash.from_hash(Fauxhai.mock(options).data)
      @client.load_node
      @client.build_node
      @client.save_updated_node
      @client
    end
1288972
def result(_binding_or_hash=TOPLEVEL_BINDING)
      _arg = _binding_or_hash
      if _arg.is_a?(Hash)
        _b = binding()
        eval _arg.collect{|k,v| "#{k} = _arg[#{k.inspect}]; "}.join, _b
      elsif _arg.is_a?(Binding)
        _b = _arg
      elsif _arg.nil?
        _b = binding()
      else
        raise ArgumentError.new("#{self.class.name}#result(): argument should be Binding or Hash but passed #{_arg.class.name} object.")
      end
      return eval(@src, _b, (@filename || '(erubis'))
    end
1363909
def have_rakefile # :nodoc:
      @rakefiles.each do |fn|
        if File.exist?(fn)
          others = FileList.glob(fn, File::FNM_CASEFOLD)
          return others.size == 1 ? others.first : fn
        elsif fn == ""
          return fn
        end
      end
      return nil
    end