 
 module.exports = exports = (schema, method = 'all') ->
   generator = new exports.Generator
-  return generator.generate schema, method
+    method: method
+
+  return generator.generate schema
 
 class exports.Generator
 
-  generate: (schema, method = 'all', depth = 0) ->
+  constructor: (options) ->
+    @method = options.method
+
+  generate: (schema, depth = 0) ->
 
     return schema  unless type(schema) is 'object'
 
-    return @enum schema, method, depth  if schema.enum
+    return @enum schema, depth  if schema.enum
 
     switch schema.type
       when 'string', 'number', 'integer', 'boolean', 'array', 'object', 'null'
-        return @[schema.type] schema, method, depth
+        return @[schema.type] schema, depth
       else
         if type(schema.type) is 'array'
-          return @oneOf schema, method, depth
+          return @oneOf schema, depth
         # FIXME what if type(schema.type) = 'object' and _.size(schema.type) > 0 ?
         if schema.type is 'any' or type(schema.type) is 'undefined' or (type(schema.type) is 'object' and _.size(schema.type) is 0)
-          return @any schema, method, depth
+          return @any schema, depth
         # FIXME what type is this?
         console.log schema.type
         throw "what type is this ?"
 
 
   # enum
-  'enum': (schema, method = 'all', depth = 0) ->
+  'enum': (schema, depth = 0) ->
     randomOptions =
       minimum: 0
       maximum: schema.enum.length - 1
     randomIndex = random 'integer', randomOptions
     enumValue = schema.enum[randomIndex]
-    @generate enumValue, method, depth + 1
+    @generate enumValue, depth + 1
 
 
   # type = null



  # type = boolean
  boolean: (schema, method = 'all', depth = 0) ->
    random 'boolean'


  # type = number / integer
  number: (schema, method = 'all', depth = 0) ->
    @integer schema, method, depth

  integer: (schema, method = 'all', depth = 0) ->
    minimum = schema.exclusiveMinimum + 1  if schema.exclusiveMinimum
    minimum ?= schema.minimum
    maximum = schema.exclusiveMaximum - 1  if schema.exclusiveMaximum



  # type = array
  array: (schema, depth = 0) ->
    o = []
    if type(schema.items) is 'array' and schema.items.length
      for itemSchema in schema.items
        o.push @generate itemSchema, depth + 1

    if schema.additionalItems
      if type(schema.minItems) isnt 'undefined'
