Created
January 3, 2013 10:38
-
-
Save reyman/4442515 to your computer and use it in GitHub Desktop.
csvtask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object CSVTask { | |
def apply(name: String, file: File)(implicit plugins: PluginSet) = | |
new TaskBuilder { builder ⇒ | |
private var _columns = new ListBuffer[(String, Prototype[_])] | |
def columns = _columns.toList | |
def addColumn(proto: Prototype[_]): this.type = this.addColumn(proto.name, proto) | |
def addColumn(name: String, proto: Prototype[_]): builder.type = { | |
_columns += (name -> proto) | |
this | |
} | |
def toTask = new CSVTask(name, file) { | |
val inputs = builder.inputs | |
val outputs = builder.outputs | |
val parameters = builder.parameters | |
val columns = builder.columns | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment