                 when 'string'
                     @readTSV(fx.fixtureDir, fx.data)
                 when 'function'
-                    fx.data(@entityPool)
+                    fx.data.call(new Scope(@, fx), @entityPool)
                 when 'object'
                     fx.data
 

            console.error e.message
            return

        debug('inserting %s models into %s', Object.keys(data).length, modelName)

        for id, obj of data
            obj.id = id
            repo.save obj,
                method : 'create'
                force  : true
                include:
                    entityPool: @entityPool


    ###*

        return objs


###*
'this' property in fixture's data function

this.readTSV('xxx.tsv') is available

    module.exports = {
        data: function(entityPool) {
            this.readTSV('model-name.tsv');
        }
    };

@class Scope
@private
###
class Scope

    constructor: (@loader, @fx) ->

    ###*
    @method readTSV
    @param {String} filename filename (directory is automatically set)
    @return {Object} tsv contents
    ###
    readTSV: (filename) ->
        @loader.readTSV(@fx.fixtureDir, filename)


module.exports = FixtureLoader
