Reputation: 2745
I have that code :
class @Validator
##
# Constructor
#
# Set basic variables
#
##
constructor: ->
@_errors = {}
##
# Errors
##
errors:
first: ->
last: ->
all: =>
return @_errors
get: ->
In the method all()
of the object errors
it's impossible to reach the content of the variable _errors
, how it's possible to reach it ?
Upvotes: 0
Views: 29
Reputation: 47172
If the API you're after is this
validator = new Validator()
validator.errors.all()
then place the errors object within the constructor and also change
errors:
first: ->
to
errors =
first: ->
Otherwise, just change
errors:
first: ->
to
errors: ->
first: ->
making the API look like this validator.errors().all()
Upvotes: 1