{"_id":"_design/raw_data","language":"javascript","views":{"modules":{"map":"function(doc) {\n var path = doc._id.split(\"::\");\n if ((path[0] == \"RevisionHistory\") && (path.length == 2) && (doc.currentRevision > 0) && (doc.revisionHistory[doc.currentRevision - 1].status == \"active\"))\n emit(path[1], null);\n}"},"modules-with-drafts":{"map":"function(doc) {\n var path = doc._id.split(\"::\");\n if ((path[0] == \"RevisionHistory\") && (path.length == 2) && (doc.revisionHistory[doc.revisionHistory.length - 1].status != \"deleted\"))\n emit(path[1], null);\n}"},"classes":{"map":"function(doc) {\n var path = doc._id.split(\"::\");\n if ((path[0] == \"RevisionHistory\") && (path.length == 3) && (doc.currentRevision > 0) && (doc.revisionHistory[doc.currentRevision - 1].status == \"active\"))\n emit(path[2], {module: path[1]});\n}"},"classes-with-drafts":{"map":"function(doc) {\n var path = doc._id.split(\"::\");\n if ((path[0] == \"RevisionHistory\") && (path.length == 3) && (doc.revisionHistory[doc.revisionHistory.length - 1].status != \"deleted\"))\n emit(path[2], {module: path[1]});\n}"},"methods":{"map":"function(doc) {\n var path = doc._id.split(\"::\");\n if ((path[0] == \"RevisionHistory\") && (path.length == 4) && (doc.currentRevision > 0) && (doc.revisionHistory[doc.currentRevision - 1].status == \"active\"))\n emit(path[3], {module: path[1], klass: path[2]});\n}"},"methods-with-drafts":{"map":"function(doc) {\n var path = doc._id.split(\"::\");\n if ((path[0] == \"RevisionHistory\") && (path.length == 4) && (doc.revisionHistory[doc.revisionHistory.length - 1].status != \"deleted\"))\n emit(path[3], {module: path[1], klass: path[2]});\n}"},"for-module":{"map":"function(doc) {\n if (doc._id.indexOf(\"Revision::\") === 0)\n emit(\"Revision::\" + doc._id.substr(doc._id.indexOf(\"::\", 10) + 2), doc);\n else if (doc._id.indexOf(\"RevisionHistory::\") === 0)\n emit(\"History::\" + doc._id.substr(17), doc);\n}"}},"shows":{"module":"function(doc, req){ return { body : \"module('\" + doc._attachments[doc.currentRevision].data + \"').requires('projects.CodeDB.base-cdb').toRun(function() { });\", headers : { \"Content-Type\" : \"application/x-javascript\" } } }","class":"function(doc, req){ return { body : \"Object.subclass('\" + doc._attachments[doc.currentRevision].data + \"', { });\", headers : { \"Content-Type\" : \"application/x-javascript\" } } }"},"lists":{"by-type":"function(head, req) {\n var row;\n var i = 0;\n var query = req.query;\n delete query.key;\n send(\"[\");\n while(row = getRow()) {\n var fits = true;\n for (var key in query) { fits &= ((row.value[key]) && (row.value[key] == query[key])) };\n if (fits) {\n if (i != 0) send(\", \");\n send(JSON.stringify(row));\n i++;\n }\n }\n send(\"]\");\n}","javascript":"function(head, req) {\n start({\n \"headers\": {\n \"Content-Type\": \"application/x-javascript\"\n }\n });\n var row;\n var typeStack = [];\n var currentRevisions = {};\n while(row = getRow()) {\n var doc = row.value;\n if (doc.currentRevision) {\n currentRevisions[doc._id.substr(17)] = doc.currentRevision;\n continue;\n }\n if (doc._id.split(\"::\")[2] != req.query[\"module\"])\n continue;\n if (doc._id.split(\"::\")[1] != currentRevisions[row.key.substr(10)])\n continue;\n switch (doc.type) {\n case \"module\":\n if (typeStack.length > 0 && (typeStack[typeStack.length - 1].type == \"module\")) {\n typeStack.pop();\n send(\"});\\n\\n\");\n }\n if (typeStack.length == 0) {\n send(\"module('$\" + req.info.db_name + \".\" + doc.name + \"').requires(\");\n if (doc.requirements.length > 0)\n send(\"'\" + doc.requirements.join(\"', '\") + \"'\");\n send(\").toRun(function() {\\n\");\n }\n typeStack.push({\"type\": doc.type, \"name\": doc.name});\n break;\n case \"class\":\n if (typeStack.length > 0 && (typeStack[typeStack.length - 1].type == \"class\")) {\n typeStack.pop();\n send(\"\\t});\\n\\n\");\n }\n send(\"\\t\" + doc.superclass + \".subclass('\" + doc.name + \"', {\\n\");\n send(\"\\t\\tdocumentation: '\" + doc.documentation + \"',\\n\\n\");\n typeStack.push({\"type\": doc.type, \"name\": doc.name});\n break;\n case \"method\":\n var source = doc.source.split(\"\\n\").join(\"\\n\\t\\t\");\n send(\"\\t\\t\" + doc.name + \": \" + source + \",\\n\");\n break;\n }\n }\n while (typeStack.length > 0) {\n var obj = typeStack.pop();\n switch (obj.type) {\n case \"module\":\n send(\"});\");\n break;\n case \"class\":\n send(\"\\t});\\n\");\n break;\n }\n }\n}"}}