     @levels = attrs.values.split(" ")
     super(attrs, options)
 
-  validate: (value) ->
+  validate: (value, attr) ->
     if value not in @levels
       throw new Error("enum property '#{attr}' given invalid value: #{value},
                        valid values are: #{@levels}")


class Array extends Property

  validate: (value) ->
    if not _.isArray(value)
      throw new Error("array property '#{attr}' given invalid value: #{value}")
    return true

class Bool extends Property

  validate: (value) ->
    if not _.isBoolean(value)
      throw new Error("boolean property '#{attr}' given invalid value: #{value}")
    return true

class Coord extends Property

  validate: (value) ->
    if not _.isNumber(value) and not _.isString(value)
      throw new Error("coordinate property '#{attr}' given invalid value: #{value}")
    return true

class Color extends Property

  validate: (value) ->
    if not svg_colors[value]? and value.substring(0, 1) != "#"
      throw new Error("color property '#{attr}' given invalid value: #{value}")
    return true

class String extends Property

  validate: (value) ->
    if not _.isString(value)
      throw new Error("string property '#{attr}' given invalid value: #{value}")
    return true

      throw new Error("field value for property '#{attr}' is not a string")

    if @fixed_value?
      @validate(@fixed_value, attr)

  value: () ->
    result = if @fixed_value? then @fixed_value else NaN
