Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added brain.remove #455

Merged
merged 1 commit into from

2 participants

@creatorrr

As an afterthought to pull request #447.

@tombell tombell merged commit c18b03a into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 28, 2013
  1. @creatorrr

    Added brain.remove

    creatorrr authored
    An afterthought.
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/brain.coffee
View
7 src/brain.coffee
@@ -35,6 +35,13 @@ class Brain extends EventEmitter
get: (key) ->
@data._private[key] ? null
+ # Public: Remove value by key from the private namespace in @data
+ # if it exists
+ #
+ # Returns the instance for chaining.
+ remove: (key) ->
+ delete @data._private[key] if @data._private[key]?
+
# Public: Emits the 'save' event so that 'brain' scripts can handle
# persisting.
#
Something went wrong with that request. Please try again.