Skip to content

Commit

Permalink
Make sure there is documentation for all the methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcath committed Jun 25, 2015
1 parent efc0417 commit d25491b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Readme.markdown
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# sodb [![Build Status](https://travis-ci.org/Arcath/sodb.svg?branch=master)](https://travis-ci.org/Arcath/sodb) [![Coverage Status](https://coveralls.io/repos/Arcath/sodb/badge.svg)](https://coveralls.io/r/Arcath/sodb) [![Dependency Status](https://david-dm.org/arcath/sodb.svg)](https://david-dm.org/arcath/sodb)
[![devDependency Status](https://david-dm.org/arcath/sodb/dev-status.svg)](https://david-dm.org/arcath/sodb#info=devDependencies)
# sodb
[![Build Status](https://travis-ci.org/Arcath/sodb.svg?branch=master)](https://travis-ci.org/Arcath/sodb) [![Coverage Status](https://coveralls.io/repos/Arcath/sodb/badge.svg)](https://coveralls.io/r/Arcath/sodb) [![Dependency Status](https://david-dm.org/arcath/sodb.svg)](https://david-dm.org/arcath/sodb) [![devDependency Status](https://david-dm.org/arcath/sodb/dev-status.svg)](https://david-dm.org/arcath/sodb#info=devDependencies)

Single Object Data Base

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"keywords": [
"searching",
"database"
"database",
"nosql"
],
"author": "Adam Laycock",
"license": "MIT",
Expand Down
18 changes: 18 additions & 0 deletions src/entry.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@ module.exports =
class Entry
___id: null

#
# constructor(object,id)
#
# object - the Object for this entry
# id - the id to assign to it
#
# Assigns all the keys of object to this instance and sents the ID
#
constructor: (@object, @___id) ->
for key in Object.keys(@object)
this[key] = @object[key]

#
# changed()
#
# compares this instance to the object to see if it has changed
#
changed: ->
changed = false
for key in Object.keys(@object)
Expand All @@ -14,6 +27,11 @@ module.exports =

return changed

#
# updateObject()
#
# sets all the object values to the ones on this instance (resets changed())
#
updateObject: ->
for key in Object.keys(@object)
@object[key] = this[key]
18 changes: 18 additions & 0 deletions src/sodb.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ module.exports =
cache: null
options: null

#
# constructor(options)
#
# options - a hash of options currently takes:
# - cache - true/false use caching features
#
constructor: (@options = {}) ->
@objects = []
@options.cache ||= false
Expand Down Expand Up @@ -174,9 +180,21 @@ module.exports =

return count

#
# toJSON()
#
# Returns a JSON string of the @objects array
#
toJSON: ->
JSON.stringify(@objects)

#
# #buildFromJSON(json)
#
# json - json string to parse
#
# Class Method, called as sodb.buildFromJSON(json). Builds a new database and returns it.
#
@buildFromJSON: (json) ->
objects = JSON.parse(json)
db = new sodb()
Expand Down

0 comments on commit d25491b

Please sign in to comment.