Permalink
Browse files

Same optimizations for paths.

  • Loading branch information...
1 parent f9d192a commit 3fd8d4291ff5cbd75fd0bf0305d50f9a31b7ecf8 @aseemk aseemk committed Apr 25, 2012
Showing with 11 additions and 7 deletions.
  1. +11 −7 lib/Path.coffee
View
@@ -8,11 +8,15 @@ module.exports = class Path
@_relationships = relationships
@_end = end
- @getter 'start', -> @_start || null
- @getter 'end', -> @_end || null
- @getter 'length', -> @_length || 0
- @getter 'nodes', -> @_nodes || []
- @getter 'relationships', -> @_relationships || []
+ # Language helpers:
+ get = (props) =>
+ @::__defineGetter__ name, getter for name, getter of props
+ set = (props) =>
+ @::__defineSetter__ name, setter for name, setter of props
- getter: @__defineGetter__
- setter: @__defineSetter__
+ # Properties:
+ get start: -> @_start || null
+ get end: -> @_end || null
+ get length: -> @_length || 0
+ get nodes: -> @_nodes || []
+ get relationships: -> @_relationships || []

0 comments on commit 3fd8d42

Please sign in to comment.